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.
- C#
- VB.NET
public abstract class Options : OptionsBase
Public MustInherit Class Options
Inherits 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
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;
Options(chart, defaults)
Constructs a new instance of the Options set.
| Name | Type | Description |
|---|---|---|
| chart | ChartJS3 | The ChartJS3 that owns this set of options. |
| defaults | Options | Default 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
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";
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:
- ArgumentNullException The value assigned is null.
- InvalidOperationException The OptionsPlugins instance assigned already belongs to another set of options.
Example:
var plugins = this.chartJS31.Options.Plugins;
plugins.Title.Text = "Visitors";
plugins.Legend.Position = HeaderPosition.Bottom;
plugins.Tooltip.Enabled = false;
plugins.DataLabels.Display = true;
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:
- ArgumentNullException The value assigned is null.
- InvalidOperationException The OptionsScales instance assigned already belongs to another set of options.
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
| Name | Description |
|---|---|
| LineOptions | Options for the Line chart. |
| BarOptions | Options for the Bar chart. |
| PieOptions | Options for the Pie chart. |
| PolarAreaOptions | Options for the PolarArea chart. |
| DoughnutOptions | Options for the Doughnut chart. |
| RadarOptions | Options for the Radar chart. |
| BubbleOptions | Options for the Bubble chart. |
| ScatterOptions | Options for the Scatter chart. |