Displays data in the form of a graphical chart.
Assembly: System.Web.Helpers (in System.Web.Helpers.dll)
Thetype exposes the following members.
|AddLegend||Adds a legend to the chart.|
|AddSeries||Provides data points and series attributes for the chart.|
|AddTitle||Adds a title to the chart.|
|DataBindCrossTable||Binds a chart to a data table, where one series is created for each unique value in a column.|
|DataBindTable||Creates and binds series data to the specified data table, and optionally populates multiple x-values.|
|Equals||(Inherited from Object.)|
|Finalize||(Inherited from Object.)|
|GetBytes||Returns a chart image as a byte array.|
|GetFromCache||Retrieves the specified chart from the cache.|
|GetHashCode||(Inherited from Object.)|
|GetType||(Inherited from Object.)|
|MemberwiseClone||(Inherited from Object.)|
|Save||Saves a chart image to the specified file.|
|SaveToCache||Saves a chart in the system cache.|
|SaveXml||Saves a chart as an XML file.|
|SetXAxis||Sets values for the horizontal axis.|
|SetYAxis||Sets values for the vertical axis.|
|ToString||(Inherited from Object.)|
|ToWebImage||Creates a WebImage object based on the current object.|
|Write||Renders the output of the object as an image.|
|WriteFromCache||Renders the output of a object that has been cached as an image.|
This class represents a helper, which is a component that simplifies web programming in ASP.NET Web Pages. You can use the class to display data in the form of a graphical chart. The class can render data using a variety of chart types, such as bar charts, column charts and pie charts. For a complete list of chart types, see Chart Types (Chart Controls).
The class can be used to customize the appearance of a chart. For instance, you can set colors, fonts, and borders of a chart. Use the ChartTheme class to quickly set the theme of a chart. Themes are collections of information that specify how to render a chart using fonts, colors, labels, palettes, borders, and effects. For more information about setting a chart theme, see the "Styling a Chart" section in Displaying Data in a Chart.
To help reduce the potential performance impact of creating a chart, you can create a chart the first time you use it and then save it. When you have to display the chart again, instead of regenerating it, you can fetch the saved version and render that. You can save a chart using one of the following methods:
As a cache entry.
As an image file.
As an XML file.
For more information about saving a chart, see the "Saving a Chart" section in Displaying Data in a Chart.
The following example shows how to use the class to create a chart image based on an array of values.
The following example shows how to use the class to create a chart image by running a database query and then binding the selected data from the results of the query.