Chart
Namespace: Wisej.Web.Ext.WebCharts
Assembly: Wisej.Web.Ext.WebCharts (4.1.0.0)
Represents a chart control that renders a Chart on the server and displays it in the browser as an image.
- C#
- VB.NET
public class Chart : Control, ISupportInitialize, IWisejHandler
Public Class Chart
Inherits Control
Implements ISupportInitialize, IWisejHandler
The chart is rendered as a PNG image with the current size of the control every time the browser requests it. The image is not refreshed automatically when the ChartAreas or Series change: call Update after changing the chart to send a new image URL to the browser.
Example:
Populating a column chart from code:
using Charting = System.Windows.Forms.DataVisualization.Charting;
private void Page1_Load(object sender, EventArgs e)
{
this.chart1.ChartAreas.Add(new Charting.ChartArea("Default"));
var sales = new Charting.Series("Sales")
{
ChartType = Charting.SeriesChartType.Column,
ChartArea = "Default"
};
sales.Points.AddXY("Q1", 120);
sales.Points.AddXY("Q2", 145);
sales.Points.AddXY("Q3", 98);
this.chart1.Series.Add(sales);
this.chart1.Update();
}
Constructors
Chart()
Initializes a new instance of Chart.
Properties
ChartAreas
ChartAreaCollection: Returns a read-only ChartAreaCollection object that is used to store ChartArea objects.
Value: A ChartAreaCollection object.
Each Series is drawn in the chart area named by its ChartArea property. Call Update after changing the collection at runtime to refresh the image in the browser.
Example:
Adding a chart area with a custom Y axis range:
var area = new System.Windows.Forms.DataVisualization.Charting.ChartArea("Revenue");
area.AxisY.Minimum = 0;
area.AxisY.Maximum = 500;
this.chart1.ChartAreas.Add(area);
this.chart1.Update();
Series
SeriesCollection: Returns a SeriesCollection object.
Value: A SeriesCollection object, which contains Series objects.
Changes to the series or to their data points are not sent to the browser automatically: call Update to render and download a new image of the chart.
Example:
Replacing the data points of an existing series:
var series = this.chart1.Series["Sales"];
series.Points.Clear();
foreach (var row in GetMonthlySales())
{
series.Points.AddXY(row.Month, row.Total);
}
this.chart1.Update();
Methods
BeginInit()
Signals to the object that initialization is starting.
Called by the designer-generated code. Use it together with EndInit to suspend the chart's internal processing while applying several changes.
Example:
Batching the initialization of a chart:
this.chart1.BeginInit();
this.chart1.Series.Add("Sales");
this.chart1.Series["Sales"].Points.AddY(42);
this.chart1.EndInit();
EndInit()
Signals to the Chart object that initialization is complete.
Example:
Completing a batched initialization started with BeginInit:
this.chart1.BeginInit();
this.chart1.ChartAreas.Add("Default");
this.chart1.EndInit();
OnCreateControl()
OnWebRender(config)
| Parameter | Type | Description |
|---|---|---|
| config | Object |
Implements
| Name | Description |
|---|---|
| IUserData | |
| IBindableComponent | |
| IDropTarget | |
| IWisejComponent | |
| IWisejControl | |
| IWisejHandler | |
| IWisejSerializable |