Skip to main content

Options

Namespace: Wisej.Web.Ext.ChartJS

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

Represents the base options for the ChartJS widget. Different ChartType values extend this class with type specific options.

public abstract class Options : OptionsBase

The Options property returns the instance of the class that matches the current ChartType: LineOptions, BarOptions (also used for HorizontalBar), PieOptions, PolarAreaOptions, DoughnutOptions, RadarOptions, BubbleOptions or ScatterOptions. Cast it to the specific class to access the type specific options.

Example:

Options options = this.chartJS1.Options;
options.Title.Text = "Revenue";
options.Legend.Display = false;

if (options is LineOptions)
((LineOptions)options).ShowLines = true;

Constructors​

Instance member Options()​

Default constructor.

Used by derived classes to create an option set that is not yet attached to a ChartJS control.

Example:

// derived classes call the default constructor.
Options options = new LineOptions();
options.Title.Text = "Temperatures";
this.chartJS1.Options = options;

Instance member Options(chart, defaults)​

Constructs a new instance of the Options set.

NameTypeDescription
chartChartJSThe ChartJS that owns this set of options.
defaultsOptionsDefault options to copy from. Can be null.

When defaults is not null, the properties shared with it are copied into the new instance. Nested option sets are copied into new instances, other properties are copied only when they have a non-default value.

Example:

// derived classes pass the arguments to the base constructor.
var options = new BarOptions(this.chartJS1, this.chartJS1.Options);
options.Stacked = true;
this.chartJS1.Options = options;

Properties​

Instance member DataLabel​

OptionsDataLabel: Options for the data label.

Value: An OptionsDataLabel instance. It is created automatically the first time the property is read.

Serialized as the dataLabel option of the chart. The data labels are rendered by the chartjs-plugin-datalabels plugin.

Throws:

Example:

var dataLabel = this.chartJS1.Options.DataLabel;
dataLabel.Display = true;
dataLabel.Anchor = DataLabelAnchor.End;
dataLabel.Align = DataLabelAlign.Top;

Instance member Legend​

OptionsLegend: Options for the chart legend.

Value: An OptionsLegend instance. It is created automatically the first time the property is read.

Serialized as the legend option of the chart.

Throws:

Example:

this.chartJS1.Options.Legend.Display = true;
this.chartJS1.Options.Legend.Position = HeaderPosition.Right;
this.chartJS1.Options.Legend.Labels.UsePointStyle = true;

Instance member Scales​

OptionsScales: Options for the chart scales.

Value: An OptionsScales instance. It is created automatically the first time the property is read.

Serialized as the scales option of the chart.

Throws:

Example:

var yAxis = this.chartJS1.Options.Scales.yAxes[0];
yAxis.Ticks.Min = 0;
yAxis.Ticks.Max = 100;
yAxis.GridLines.Display = false;

Instance member Title​

OptionsTitle: Options for the chart title.

Value: An OptionsTitle instance. It is created automatically the first time the property is read.

Serialized as the title option of the chart.

Throws:

Example:

this.chartJS1.Options.Title.Display = true;
this.chartJS1.Options.Title.Text = "Quarterly Results";
this.chartJS1.Options.Title.Position = HeaderPosition.Bottom;

Instance member Tooltips​

OptionsTooltips: Options for the chart tooltips.

Value: An OptionsTooltips instance. It is created automatically the first time the property is read.

Serialized as the tooltips option of the chart.

Throws:

Example:

// hide the tooltips when the user hovers the data points.
this.chartJS1.Options.Tooltips.Enabled = false;

Inherited By​

NameDescription
LineOptionsOptions for the Line chart.
BarOptionsOptions for the Bar chart.
PieOptionsOptions for the Pie chart.
PolarAreaOptionsOptions for the PolarArea chart.
DoughnutOptionsOptions for the Doughnut chart.
RadarOptionsOptions for the Radar chart.
BubbleOptionsOptions for the Bubble chart.
ScatterOptionsOptions for the Scatter chart.