Skip to main content

PluginsOptions

Namespace: Wisej.Web.Ext.ChartJS4.Models

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

Represents the configuration of the built-in Chart.js plugins (Chart.js options.plugins): legend, title, subtitle, tooltip, decimation, filler and the chartjs-plugin-datalabels plugin.

public class PluginsOptions : OptionsBase

Nested plugin options are not instantiated by default. They are created lazily the first time the corresponding property is read, and only configured plugins are serialized to the client. Options for plugins that are not exposed as typed properties can be added through ExtensionData or CustomOptions.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Plugins.Legend.Position = "bottom";
chart.ChartOptions.Plugins.Title.Display = true;
chart.ChartOptions.Plugins.Title.Text = "Monthly Sales";

Constructors​

Instance member PluginsOptions()​

Initializes a new instance of the PluginsOptions class.

The nested plugin options (Legend, Title, Tooltip, etc.) are not created by the constructor; they are lazily instantiated on first access.

Example:

var chart = new ChartJS4();
var plugins = new PluginsOptions();
plugins.Tooltip.Mode = "index";
chart.ChartOptions.Plugins = plugins;

Properties​

Instance member DataLabels​

DataLabelsOptions: Returns or sets the configuration of the chartjs-plugin-datalabels plugin that draws labels on the data elements (Chart.js options.plugins.datalabels). (Default: null)

Value: A DataLabelsOptions instance. The getter lazily creates a default instance on first access, so it never returns null; the default is null (not configured).

When this options object is serialized, the client registers the datalabels plugin for the chart. Labels are drawn only when Display is true. Only a configured instance is sent to the client; an instance that was never accessed or that still has all default values is omitted from the generated configuration. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.DataLabels.Display = true;
plugins.DataLabels.Anchor = "end";
plugins.DataLabels.Align = "top";

Instance member Decimation​

DecimationOptions: Returns or sets the decimation plugin configuration used to downsample large line chart datasets (Chart.js options.plugins.decimation). (Default: null)

Value: A DecimationOptions instance. The getter lazily creates a default instance on first access, so it never returns null; the default is null (not configured).

See DecimationOptions for the requirements of the Chart.js decimation plugin. Only a configured instance is sent to the client; an instance that was never accessed or that still has all default values is omitted from the generated configuration. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.Decimation.Enabled = true;
plugins.Decimation.Algorithm = "lttb";
plugins.Decimation.Samples = 500;

Instance member Filler​

FillerOptions: Returns or sets the filler plugin configuration used by area (filled line and radar) charts (Chart.js options.plugins.filler). (Default: null)

Value: A FillerOptions instance. The getter lazily creates a default instance on first access, so it never returns null; the default is null (not configured).

Only a configured instance is sent to the client; an instance that was never accessed or that still has all default values is omitted from the generated configuration. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
bool propagate = plugins.Filler.Propagate;

Instance member Legend​

LegendOptions: Returns or sets the legend configuration (Chart.js options.plugins.legend). (Default: null)

Value: A LegendOptions instance. The getter lazily creates a default instance on first access, so it never returns null; the default is null (not configured).

The legend displays the list of datasets (or data labels for pie/doughnut charts) and allows toggling their visibility. Only a configured instance is sent to the client; an instance that was never accessed or that still has all default values is omitted from the generated configuration. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.Legend.Display = true;
plugins.Legend.Position = "bottom";

Instance member Subtitle​

SubtitleOptions: Returns or sets the chart subtitle configuration (Chart.js options.plugins.subtitle). (Default: null)

Value: A SubtitleOptions instance. The getter lazily creates a default instance on first access, so it never returns null; the default is null (not configured).

The subtitle is displayed below the title and uses the same options. Only a configured instance is sent to the client; an instance that was never accessed or that still has all default values is omitted from the generated configuration. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.Subtitle.Display = true;
plugins.Subtitle.Text = "Fiscal year 2025";

Instance member Title​

TitleOptions: Returns or sets the chart title configuration (Chart.js options.plugins.title). (Default: null)

Value: A TitleOptions instance. The getter lazily creates a default instance on first access, so it never returns null; the default is null (not configured).

The title is displayed above the chart by default. Only a configured instance is sent to the client; an instance that was never accessed or that still has all default values is omitted from the generated configuration. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.Title.Display = true;
plugins.Title.Text = "Monthly Sales";

Instance member Tooltip​

TooltipOptions: Returns or sets the tooltip configuration (Chart.js options.plugins.tooltip). (Default: null)

Value: A TooltipOptions instance. The getter lazily creates a default instance on first access, so it never returns null; the default is null (not configured).

The tooltip is displayed when the user hovers over or taps chart elements. Only a configured instance is sent to the client; an instance that was never accessed or that still has all default values is omitted from the generated configuration. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.Tooltip.Enabled = true;

Methods​

Protected member OnChartChanged()​

Called when the Chart reference changes.

Instance member ResetDataLabels()​

Resets the DataLabels property to its default value.

Discards the current DataLabelsOptions instance; a new default instance is created on the next access to DataLabels. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.ResetDataLabels();

Instance member ResetDecimation()​

Resets the Decimation property to its default value.

Discards the current DecimationOptions instance; a new default instance is created on the next access to Decimation. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.ResetDecimation();

Instance member ResetFiller()​

Resets the Filler property to its default value.

Discards the current FillerOptions instance; a new default instance is created on the next access to Filler. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.ResetFiller();

Instance member ResetLegend()​

Resets the Legend property to its default value.

Discards the current LegendOptions instance; a new default instance is created on the next access to Legend. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.ResetLegend();

Instance member ResetSubtitle()​

Resets the Subtitle property to its default value.

Discards the current SubtitleOptions instance; a new default instance is created on the next access to Subtitle. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.ResetSubtitle();

Instance member ResetTitle()​

Resets the Title property to its default value.

Discards the current TitleOptions instance; a new default instance is created on the next access to Title. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.ResetTitle();

Instance member ResetTooltip()​

Resets the Tooltip property to its default value.

Discards the current TooltipOptions instance; a new default instance is created on the next access to Tooltip. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var chart = new ChartJS4();
var plugins = chart.ChartOptions.Plugins;
plugins.ResetTooltip();

Instance member ShouldSerializeDataLabels()​

Returns whether the DataLabels property has been changed from its default value and should be serialized by the designer.

Returns: Boolean. true if the DataLabels options have been created and at least one of their values differs from its default; otherwise false.

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (plugins.ShouldSerializeDataLabels())
plugins.ResetDataLabels();

Instance member ShouldSerializeDecimation()​

Returns whether the Decimation property has been changed from its default value and should be serialized by the designer.

Returns: Boolean. true if the Decimation options have been created and at least one of their values differs from its default; otherwise false.

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (plugins.ShouldSerializeDecimation())
plugins.ResetDecimation();

Instance member ShouldSerializeFiller()​

Returns whether the Filler property has been changed from its default value and should be serialized by the designer.

Returns: Boolean. true if the Filler options have been created and at least one of their values differs from its default; otherwise false.

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (plugins.ShouldSerializeFiller())
plugins.ResetFiller();

Instance member ShouldSerializeLegend()​

Returns whether the Legend property has been changed from its default value and should be serialized by the designer.

Returns: Boolean. true if the Legend options have been created and at least one of their values differs from its default; otherwise false.

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (plugins.ShouldSerializeLegend())
plugins.ResetLegend();

Instance member ShouldSerializeSubtitle()​

Returns whether the Subtitle property has been changed from its default value and should be serialized by the designer.

Returns: Boolean. true if the Subtitle options have been created and at least one of their values differs from its default; otherwise false.

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (plugins.ShouldSerializeSubtitle())
plugins.ResetSubtitle();

Instance member ShouldSerializeTitle()​

Returns whether the Title property has been changed from its default value and should be serialized by the designer.

Returns: Boolean. true if the Title options have been created and at least one of their values differs from its default; otherwise false.

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (plugins.ShouldSerializeTitle())
plugins.ResetTitle();

Instance member ShouldSerializeTooltip()​

Returns whether the Tooltip property has been changed from its default value and should be serialized by the designer.

Returns: Boolean. true if the Tooltip options have been created and at least one of their values differs from its default; otherwise false.

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (plugins.ShouldSerializeTooltip())
plugins.ResetTooltip();