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


Type: System.Int32
The width, in pixels, of the complete chart image.
Type: System.Int32
The height, in pixels, of the complete chart image.
Type: System.String
(Optional) The template (theme) to apply to the chart.
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") 

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