Skip to main content

ChartModelBase

Namespace: Wisej.Web.Ext.ChartJS4.Models

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

Base class for chart models that need a back-reference to the owning chart.

public abstract class ChartModelBase

Derived models (options and data sets) use the back-reference to refresh the owning ChartJS4 control when one of their properties changes. When a property is assigned a child ChartModelBase instance, the child is automatically bound to the same chart.

Example:

var dataSet = new LineDataSet { Label = "Temperature" };
chart.DataSets.Add(dataSet);
// dataSet.Chart == chart: changing a property now refreshes the chart.
dataSet.BorderWidth = 3;

Properties​

Instance member Chart​

ChartJS4: Returns or sets the owning chart instance.

Value: The ChartJS4 control that owns this model, or null if the model is not attached to a chart.

The value is set automatically when the model is assigned to ChartOptions, added to DataSets, or assigned to a property of another attached model. It is excluded from JSON serialization and hidden from the property grid.

Example:

var owner = chart.ChartOptions.Chart; // == chart
var dataSet = new BarDataSet();
chart.DataSets.Add(dataSet); // dataSet.Chart == chart

Methods​

Protected member OnChartChanged()​

Called when the Chart reference changes.

Protected member SetProperty<T>(field, value, propertyName)​

Assigns the field value and triggers chart updates when changed.

ParameterTypeDescription
T
field by referenceT
valueT
propertyName optionalString

Returns: Boolean.

Protected member Update()​

Triggers a chart refresh.

Inherited By​

NameDescription
AnimationsOptionsAnimation options.
ArcElementOptionsRepresents the default styling options of the arc elements used by pie, doughnut and polar area charts (Chart.js options.elements.arc).
AxisOptionsRepresents the configuration of a chart axis (scale), serialized as a Chart.js scales[id] entry.
AxisTitleOptionsRepresents the options of an axis title, the label displayed along an axis (Chart.js scales[id].title).
BarElementOptionsRepresents the default styling options of the bar elements used by bar charts (Chart.js options.elements.bar).
BorderOptionsRepresents the options of the axis border line, drawn at the edge between the axis and the chart area (Chart.js scales[id].border).
ChartDataSetBase class for all chart data sets. Represents data to be plotted on a chart with flexible serialization.
LineDataSetData set for line charts.
BarDataSetData set for bar charts.
PieDataSetData set for pie and doughnut charts.
BubbleDataSetData set for bubble charts.
ScatterDataSetData set for scatter charts.
RadarDataSetData set for radar charts.
PolarAreaDataSetData set for polar area charts.
ChartOptionsBase class for all chart options. Uses System.Text.Json for modern, flexible serialization.
DataLabelsOptionsRepresents 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.
DecimationOptionsRepresents the options of the Chart.js decimation plugin (options.plugins.decimation), used to downsample large line chart datasets for faster rendering.
ElementsOptionsRepresents the default styling options of the chart elements (Chart.js options.elements): points, lines, bars and arcs.
FillerOptionsRepresents 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.
FontOptionsRepresents the font options used to render text elements of the chart (Chart.js font object with family, size, style, weight and lineHeight).
GridOptionsRepresents the grid line options of an axis (Chart.js scales[id].grid).
InteractionOptionsRepresents the Chart.js interaction options (options.interaction) that control how hover and tooltip interactions select chart elements.
LayoutOptionsRepresents the chart layout options (Chart.js options.layout).
LegendLabelsOptionsRepresents the configuration of the legend labels (Chart.js options.plugins.legend.labels), which controls the colored boxes and text of each legend item.
LegendOptionsRepresents the configuration of the Chart.js legend plugin (options.plugins.legend), which displays the datasets of the chart and lets the user toggle them.
LegendTitleOptionsRepresents the configuration of the legend title (Chart.js options.plugins.legend.title).
LineElementOptionsRepresents the default styling options of the line elements used by line and radar charts (Chart.js options.elements.line).
OptionsBaseBase class for Chart.js option groups (e.g. legend, title, scales) that can detect and restore their default state.
PaddingOptionsRepresents padding values, in pixels, for each side of an element (Chart.js padding object with top, right, bottom and left).
PluginsOptionsRepresents 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.
PointElementOptionsRepresents the default styling options of the point elements used by line, radar, scatter and bubble charts (Chart.js options.elements.point).
ScalesOptionsScales options (Chart.js options.scales).
SubtitleOptionsRepresents the configuration of the Chart.js subtitle plugin (options.plugins.subtitle), which draws a second line of text below the chart title.
TickOptionsRepresents the options of the tick labels of an axis (Chart.js scales[id].ticks).
TitleOptionsRepresents the configuration of the Chart.js title plugin (options.plugins.title), which draws a title above (or beside) the chart.
TooltipOptionsRepresents 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.
TransitionsOptionsTransitions options (Chart.js options.transitions).