Skip to main content

Options

Namespace: Wisej.Web.Ext.ChartJS3

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

Represents the base options for the ChartJS3 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. In Chart.js 3 the title, legend, tooltip and data labels options are grouped under Plugins.

Example:

Options options = this.chartJS31.Options;
options.Plugins.Title.Text = "Revenue";
options.Plugins.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 ChartJS3 control.

Example:

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

Instance member Options(chart, defaults)​

Constructs a new instance of the Options set.

NameTypeDescription
chartChartJS3The ChartJS3 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.chartJS31, this.chartJS31.Options);
options.IndexAxis = "y";
this.chartJS31.Options = options;

Properties​

Instance member IndexAxis​

String: Returns or sets the index axis of the chart. (Default: "x")

Value: The name of the index axis: "x" or "y". The default is "x".

Serialized as the Chart.js 3 indexAxis option: the axis used as the base of the data points. Set it to "y" to draw horizontal bars in a bar chart. The value is not validated. Changing the value calls Update.

Example:

// draw the bars horizontally.
this.chartJS31.ChartType = ChartType.Bar;
this.chartJS31.Options.IndexAxis = "y";

Instance member Plugins​

OptionsPlugins: Options for the chart plugins.

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

Serialized as the Chart.js 3 plugins option, which contains the title, legend, tooltip and data labels options. Assigning a new instance doesn't update the chart, call Update to refresh it.

Throws:

Example:

var plugins = this.chartJS31.Options.Plugins;
plugins.Title.Text = "Visitors";
plugins.Legend.Position = HeaderPosition.Bottom;
plugins.Tooltip.Enabled = false;
plugins.DataLabels.Display = 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. The axes defined in xAxes and yAxes are converted on the client into the Chart.js 3 scales object, using the keys x0, x1, ... and y0, y1, ... Assigning a new instance doesn't update the chart, call Update to refresh it.

Throws:

Example:

var yAxis = this.chartJS31.Options.Scales.yAxes[0];
yAxis.Ticks.BeginAtZero = true;
yAxis.SuggestedMax = 100;
yAxis.Title.Display = true;
yAxis.Title.Text = "Percent";

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.