OptionsBase
Namespace: Wisej.Web.Ext.ChartJS4.Models
Assembly: Wisej.Web.Ext.ChartJS4 (4.1.0.0)
Base class for Chart.js option groups (e.g. legend, title, scales) that can detect and restore their default state.
- C#
- VB.NET
public abstract class OptionsBase : ChartModelBase
Public MustInherit Class OptionsBase
Inherits ChartModelBase
Default values are determined from a fresh instance of the concrete type with every DefaultValueAttribute applied. Only public, readable, writable properties that are not marked [Browsable(false)] are considered. The designer uses IsDefault in the ShouldSerializeX() methods of the parent options to skip serializing unchanged option groups.
Example:
var legend = chart.ChartOptions.Plugins.Legend;
legend.Position = "bottom";
if (!legend.IsDefault)
legend.Reset();
Properties
IsDefault
Boolean: Returns whether all the options in this group still have their default values.
Value: true if every relevant property equals its default value and every nested OptionsBase is either null or itself default; otherwise false.
Compares the public, readable, writable and browsable properties with the values of a default instance (with the DefaultValueAttribute values applied). The property is excluded from JSON serialization and hidden from the property grid.
Example:
var title = chart.ChartOptions.Plugins.Title;
bool unchanged = title.IsDefault; // true
title.Text = "Sales";
unchanged = title.IsDefault; // false
Methods
Reset()
Sets all properties back to their default values.
Assigns to every public, readable, writable and browsable property the value it has on a default instance (with the DefaultValueAttribute values applied). Nested option-group properties are assigned the value read from that default instance. Derived classes can override this method to reset additional state.
Example:
chart.ChartOptions.Plugins.Legend.Reset();
Inherited By
| Name | Description |
|---|---|
| AnimationsOptions | Animation options. |
| ArcElementOptions | Represents the default styling options of the arc elements used by pie, doughnut and polar area charts (Chart.js options.elements.arc). |
| AxisOptions | Represents the configuration of a chart axis (scale), serialized as a Chart.js scales[id] entry. |
| AxisTitleOptions | Represents the options of an axis title, the label displayed along an axis (Chart.js scales[id].title). |
| BarElementOptions | Represents the default styling options of the bar elements used by bar charts (Chart.js options.elements.bar). |
| BorderOptions | Represents the options of the axis border line, drawn at the edge between the axis and the chart area (Chart.js scales[id].border). |
| DataLabelsOptions | Represents the options of the chartjs-plugin-datalabels plugin (Chart.js options.plugins.datalabels), which draws labels next to or on top of the data elements. |
| DecimationOptions | Represents the options of the Chart.js decimation plugin (options.plugins.decimation), used to downsample large line chart datasets for faster rendering. |
| ElementsOptions | Represents the default styling options of the chart elements (Chart.js options.elements): points, lines, bars and arcs. |
| FillerOptions | Represents the options of the Chart.js filler plugin (options.plugins.filler), which fills the area of line and radar datasets that have the fill option set. |
| FontOptions | Represents the font options used to render text elements of the chart (Chart.js font object with family, size, style, weight and lineHeight). |
| GridOptions | Represents the grid line options of an axis (Chart.js scales[id].grid). |
| InteractionOptions | Represents the Chart.js interaction options (options.interaction) that control how hover and tooltip interactions select chart elements. |
| LayoutOptions | Represents the chart layout options (Chart.js options.layout). |
| LegendLabelsOptions | Represents the configuration of the legend labels (Chart.js options.plugins.legend.labels), which controls the colored boxes and text of each legend item. |
| LegendOptions | Represents the configuration of the Chart.js legend plugin (options.plugins.legend), which displays the datasets of the chart and lets the user toggle them. |
| LegendTitleOptions | Represents the configuration of the legend title (Chart.js options.plugins.legend.title). |
| LineElementOptions | Represents the default styling options of the line elements used by line and radar charts (Chart.js options.elements.line). |
| PaddingOptions | Represents padding values, in pixels, for each side of an element (Chart.js padding object with top, right, bottom and left). |
| PluginsOptions | 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. |
| PointElementOptions | Represents the default styling options of the point elements used by line, radar, scatter and bubble charts (Chart.js options.elements.point). |
| ScalesOptions | Scales options (Chart.js options.scales). |
| SubtitleOptions | Represents the configuration of the Chart.js subtitle plugin (options.plugins.subtitle), which draws a second line of text below the chart title. |
| TickOptions | Represents the options of the tick labels of an axis (Chart.js scales[id].ticks). |
| TitleOptions | Represents the configuration of the Chart.js title plugin (options.plugins.title), which draws a title above (or beside) the chart. |
| TooltipOptions | Represents the configuration of the Chart.js tooltip plugin (options.plugins.tooltip), which controls when tooltips are shown, how they are positioned and how they look. |
| TransitionsOptions | Transitions options (Chart.js options.transitions). |