OptionsPlugins
Namespace: Wisej.Web.Ext.ChartJS3
Assembly: Wisej.Web.Ext.ChartJS3 (4.1.0.0)
Represents the options for the plugins.
- C#
- VB.NET
public class OptionsPlugins : OptionsBase
Public Class OptionsPlugins
Inherits OptionsBase
Use the Plugins property to access the plugin options of a ChartJS3 control. The options are serialized as the Chart.js 3 plugins option and group the title, legend and tooltip options, together with the options of the chartjs-plugin-datalabels plugin.
Example:
OptionsPlugins plugins = this.chartJS31.Options.Plugins;
plugins.Title.Text = "Traffic Sources";
plugins.Legend.Position = HeaderPosition.Right;
plugins.DataLabels.Display = true;
Constructors
OptionsPlugins()
Default constructor.
Creates a standalone set of plugin options that can be assigned to Plugins.
Example:
var plugins = new OptionsPlugins();
plugins.Title.Text = "Downloads";
plugins.Legend.Display = false;
this.chartJS31.Options.Plugins = plugins;
this.chartJS31.Options.Update();
OptionsPlugins(owner)
Constructs a new instance of the OptionsPlugins set.
| Name | Type | Description |
|---|---|---|
| owner | OptionsBase | The OptionsBase set of options that owns this set of options. |
The ChartJS3 control is resolved through owner . The instance can be assigned only to the option set specified in owner .
Example:
var options = this.chartJS31.Options;
var plugins = new OptionsPlugins(options);
plugins.Tooltip.Enabled = false;
options.Plugins = plugins;
options.Update();
Properties
DataLabels
OptionsDataLabels: Options for the data labels.
Value: An OptionsDataLabels instance. It is created automatically the first time the property is read.
Configures the chartjs-plugin-datalabels plugin. The options are serialized as plugins.dataLabels and renamed on the client to the plugins.datalabels option expected by the plugin. When the data set provides formatted values, the labels show them instead of the raw values. Assigning a new instance doesn't update the chart, call Update to refresh it.
Throws:
- ArgumentNullException The value assigned is null.
- InvalidOperationException The OptionsDataLabels instance assigned already belongs to another set of options.
Example:
var labels = this.chartJS31.Options.Plugins.DataLabels;
labels.Display = true;
labels.Anchor = DataLabelAnchor.End;
labels.Color = Color.White;
labels.BackgroundColor = Color.SteelBlue;
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 Chart.js 3 plugins.legend option. Assigning a new instance doesn't update the chart, call Update to refresh it.
Throws:
- ArgumentNullException The value assigned is null.
- InvalidOperationException The OptionsLegend instance assigned already belongs to another set of options.
Example:
var legend = this.chartJS31.Options.Plugins.Legend;
legend.Display = true;
legend.Position = HeaderPosition.Right;
legend.Labels.UsePointStyle = true;
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 Chart.js 3 plugins.title option. Assigning a new instance doesn't update the chart, call Update to refresh it.
Throws:
- ArgumentNullException The value assigned is null.
- InvalidOperationException The OptionsTitle instance assigned already belongs to another set of options.
Example:
var title = this.chartJS31.Options.Plugins.Title;
title.Display = true;
title.Text = "Quarterly Results";
title.Position = HeaderPosition.Bottom;
Tooltip
OptionsTooltips: Options for the chart tooltip.
Value: An OptionsTooltips instance. It is created automatically the first time the property is read.
Serialized as the Chart.js 3 plugins.tooltip option. Assigning a new instance doesn't update the chart, call Update to refresh it.
Throws:
- ArgumentNullException The value assigned is null.
- InvalidOperationException The OptionsTooltips instance assigned already belongs to another set of options.
Example:
// hide the tooltips when the user hovers the data points.
this.chartJS31.Options.Plugins.Tooltip.Enabled = false;