SubtitleOptions
Namespace: Wisej.Web.Ext.ChartJS4.Models
Assembly: Wisej.Web.Ext.ChartJS4 (4.1.0.0)
Represents the configuration of the Chart.js subtitle plugin (options.plugins.subtitle), which draws a second line of text below the chart title.
- C#
- VB.NET
public class SubtitleOptions : OptionsBase
Public Class SubtitleOptions
Inherits OptionsBase
An instance is created lazily by Subtitle. The subtitle is only drawn when Display is true. Changing any property updates the chart. Options that are not exposed as properties can be added through ExtensionData.
Example:
var chart = new ChartJS4();
var subtitle = chart.ChartOptions.Plugins.Subtitle;
subtitle.Display = true;
subtitle.Text = "Figures in thousands of USD";
subtitle.Font.Style = "italic";
Constructors
SubtitleOptions()
Initializes a new instance of SubtitleOptions.
Properties
Color
Object: Returns or sets the color of the subtitle text (Chart.js color).
Value: A Color or a CSS color string. The default is null, which uses the Chart.js default font color.
Example:
var chart = new ChartJS4();
chart.ChartOptions.Plugins.Subtitle.Color = "#888888";
Display
Boolean: Returns or sets whether the subtitle is shown (Chart.js display). (Default: False)
Value: true to show the subtitle; otherwise false. The default is false.
Example:
var chart = new ChartJS4();
chart.ChartOptions.Plugins.Subtitle.Display = true;
chart.ChartOptions.Plugins.Subtitle.Text = "Q1 2026";
Font
FontOptions: Returns or sets the font configuration of the subtitle (Chart.js font).
Value: A FontOptions instance. The getter creates an empty instance on first access, so nested properties can be set directly.
Example:
var chart = new ChartJS4();
chart.ChartOptions.Plugins.Subtitle.Font.Size = 12;
chart.ChartOptions.Plugins.Subtitle.Font.Style = "italic";
Padding
Int32: Returns or sets the padding, in pixels, applied around the subtitle (Chart.js padding).
Value: The padding in pixels. The default is 0, which is not serialized, so Chart.js uses its default.
Example:
var chart = new ChartJS4();
chart.ChartOptions.Plugins.Subtitle.Padding = 10;
Text
Object: Returns or sets the subtitle text (Chart.js text).
Value: A String, or an array of strings to render the subtitle on multiple lines. The default is null.
The subtitle is only drawn when Display is true.
Example:
var chart = new ChartJS4();
chart.ChartOptions.Plugins.Subtitle.Display = true;
chart.ChartOptions.Plugins.Subtitle.Text = "Figures in thousands of USD";
Methods
OnChartChanged()
Called when the Chart reference changes.
ResetColor()
Resets the Color property to its default value (null).
Used by the designer to restore the default value.
Example:
chart.ChartOptions.Plugins.Subtitle.ResetColor();
ResetDisplay()
Resets the Display property to its default value (false).
Used by the designer to restore the default value.
Example:
chart.ChartOptions.Plugins.Subtitle.ResetDisplay();
ResetFont()
Resets the Font property to its default value by discarding the current FontOptions instance.
Used by the designer to restore the default value. A new, empty FontOptions is created the next time Font is read.
Example:
chart.ChartOptions.Plugins.Subtitle.ResetFont();
ResetPadding()
Resets the Padding property to its default value (0).
Used by the designer to restore the default value.
Example:
chart.ChartOptions.Plugins.Subtitle.ResetPadding();
ResetText()
Resets the Text property to its default value (null).
Used by the designer to restore the default value.
Example:
chart.ChartOptions.Plugins.Subtitle.ResetText();
ShouldSerializeColor()
Determines whether the Color property should be serialized by the designer.
Returns: Boolean. true if Color is not null; otherwise false.
Used by the designer together with ResetColor.
Example:
var subtitle = chart.ChartOptions.Plugins.Subtitle;
if (subtitle.ShouldSerializeColor())
subtitle.ResetColor();
ShouldSerializeDisplay()
Determines whether the Display property should be serialized by the designer.
Returns: Boolean. true if Display is not false (its default); otherwise false.
Used by the designer together with ResetDisplay.
Example:
var subtitle = chart.ChartOptions.Plugins.Subtitle;
if (subtitle.ShouldSerializeDisplay())
subtitle.ResetDisplay();
ShouldSerializeFont()
Determines whether the Font property should be serialized by the designer.
Returns: Boolean. true if Font is not null and has at least one non-default value (see IsDefault); otherwise false.
Used by the designer together with ResetFont.
Example:
var subtitle = chart.ChartOptions.Plugins.Subtitle;
if (subtitle.ShouldSerializeFont())
subtitle.ResetFont();
ShouldSerializePadding()
Determines whether the Padding property should be serialized by the designer.
Returns: Boolean. true if Padding is not 0 (its default); otherwise false.
Used by the designer together with ResetPadding.
Example:
var subtitle = chart.ChartOptions.Plugins.Subtitle;
if (subtitle.ShouldSerializePadding())
subtitle.ResetPadding();
ShouldSerializeText()
Determines whether the Text property should be serialized by the designer.
Returns: Boolean. true if Text is not null; otherwise false.
Used by the designer together with ResetText.
Example:
var subtitle = chart.ChartOptions.Plugins.Subtitle;
if (subtitle.ShouldSerializeText())
subtitle.ResetText();