Skip to main content

ejChart

Namespace: Wisej.Web.Ext.Syncfusion

Assembly: Wisej.Web.Ext.Syncfusion (4.1.0.0)

Essential Chart for JavaScript is a visually stunning Charting component. It includes common Chart types ranging from line Charts to specialized financial Charts.

public class ejChart : ejBase

Constructors​

Instance member ejChart()​

Constructs a new instance of the ejChart class.

Example:

The following example creates the chart and defines the title and one series through the options.

var chart = new ejChart();
chart.Options.title = new { text = "Sales" };
chart.Options.series = new[]
{
new { dataSource = sales, xName = "Month", yName = "Total", type = "line" }
};
chart.Dock = DockStyle.Fill;
this.Controls.Add(chart);

Instance member ejChart(options)​

Constructs a new instance of the ejChart class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example creates a column chart with a series of points.

var chart = new ejChart(new
{
title = new { text = "Sales by quarter" },
series = new[]
{
new
{
name = "2025",
type = "column",
points = new[]
{
new { x = "Q1", y = 120 },
new { x = "Q2", y = 150 },
new { x = "Q3", y = 90 },
new { x = "Q4", y = 180 }
}
}
}
});
chart.Dock = DockStyle.Fill;
this.Controls.Add(chart);

Methods​

Instance member ExportImage(callback)​

Exports the chart to an image.

ParameterTypeDescription
callbackAction<Image>Callback method that receives the image, or null when the chart could not be exported.

The image is created in the browser, which switches the chart to canvas rendering, and is drawn on the server over a background filled with the BackColor of the control. The method returns immediately; the callback is invoked when the client returns the image.

Throws:

Example:

this.chart1.ExportImage((image) =>
{
this.pictureBox1.Image = image;
});

Instance member ExportImageAsync()​

Exports the chart to an image asynchronously.

Returns: Task<Image>. An awaitable Task that returns the image that represents the chart, or null when the chart could not be exported.

The image is created in the browser, which switches the chart to canvas rendering, and is drawn on the server over a background filled with the BackColor of the control.

Example:

private async void buttonExport_Click(object sender, EventArgs e)
{
var image = await this.chart1.ExportImageAsync();
if (image != null)
image.Save(Path.Combine(Path.GetTempPath(), "chart.png"), ImageFormat.Png);
}

Implements​