Share via


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
Public method Chart Initializes a new instance of the Chart class.

Top

Properties

  Name Description
Public property FileName Gets or sets the name of the file that contains the chart image.
Public property Height Gets or sets the height, in pixels, of the chart image.
Public property Width Gets or set the width, in pixels, of the chart image.

Top

Methods

  Name Description
Public method AddLegend Adds a legend to the chart.
Public method AddSeries Provides data points and series attributes for the chart.
Public method AddTitle Adds a title to the chart.
Public method DataBindCrossTable Binds a chart to a data table, where one series is created for each unique value in a column.
Public method DataBindTable Creates and binds series data to the specified data table, and optionally populates multiple x-values.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetBytes Returns a chart image as a byte array.
Public methodStatic member GetFromCache Retrieves the specified chart from the cache.
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Public method Save Saves a chart image to the specified file.
Public method SaveToCache Saves a chart in the system cache.
Public method SaveXml Saves a chart as an XML file.
Public method SetXAxis Sets values for the horizontal axis.
Public method SetYAxis Sets values for the vertical axis.
Public method ToString (Inherited from Object.)
Public method ToWebImage Creates a WebImage object based on the current Chart object.
Public method Write Renders the output of the Chart object as an image.
Public methodStatic member 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.

See Also

Reference

System.Web.Helpers Namespace

Other Resources

Displaying Data in a Chart