Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library

Chart Constructor

Initializes a new instance of the Chart class.

Namespace:  System.Web.Helpers
Assembly:  System.Web.Helpers (in System.Web.Helpers.dll)

public Chart(
	int width,
	int height,
	string theme,
	string themePath
)

Parameters

width
Type: System.Int32
The width, in pixels, of the complete chart image.
height
Type: System.Int32
The height, in pixels, of the complete chart image.
theme
Type: System.String
(Optional) The template (theme) to apply to the chart.
themePath
Type: System.String
(Optional) The template (theme) path and file name to apply to the chart.

A chart can be created using either the optional theme parameter or the optional themePath parameter. If you specify both of these parameters, only the theme parameter will be applied.

The following example shows how to use the Chart class to create a chart image using the width, height, and theme parameters.


@{ 
    var db = Database.Open("SmallBakery"); 
    var data = db.Query("SELECT Name, Price FROM Product"); 
    var key = new Chart(width: 600,  
                        height: 400, 
                        theme: ChartTheme.Green) 
        .AddTitle("Product Sales") 
        .DataBindTable(data, "Name") 
        .Write(); 
}


  • Medium trust for the immediate caller. This member can be used by partially trusted code.
Show:
© 2015 Microsoft