Chart Class
Displays data in the form of a graphical chart.
Inheritance Hierarchy
System.Object
System.Web.Helpers.Chart
Namespace: System.Web.Helpers
Assembly: System.Web.Helpers (in System.Web.Helpers.dll)
Syntax
'Declaration
Public Class Chart
'Usage
Dim instance As Chart
public class Chart
public ref class Chart
type Chart = class end
public class Chart
The Chart type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Chart | Initializes a new instance of the Chart class. |
Top
Properties
Name | Description | |
---|---|---|
FileName | Gets or sets the name of the file that contains the chart image. | |
Height | Gets or sets the height, in pixels, of the chart image. | |
Width | Gets or set the width, in pixels, of the chart image. |
Top
Methods
Name | Description | |
---|---|---|
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 Chart object. | |
Write | Renders the output of the Chart object as an image. | |
WriteFromCache | Renders the output of a Chart object that has been cached as an image. |
Top
Remarks
This class represents a helper, which is a component that simplifies web programming in ASP.NET Web Pages. You can use the Chart 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 Chart 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.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.