Skip to main content

TitleOptions

Namespace: Wisej.Web.Ext.ChartJS4.Models

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

Represents the configuration of the Chart.js title plugin (options.plugins.title), which draws a title above (or beside) the chart.

public class TitleOptions : OptionsBase

An instance is created lazily by Title. The title 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 title = chart.ChartOptions.Plugins.Title;
title.Display = true;
title.Text = "Monthly Sales";
title.Font.Size = 18;

Constructors​

Instance member TitleOptions()​

Initializes a new instance of TitleOptions.

Properties​

Instance member Align​

String: Returns or sets the alignment of the title (Chart.js align).

Value: One of "start" | "center" | "end". The default is null, in which case Chart.js uses "center".

Example:

var chart = new ChartJS4();
chart.ChartOptions.Plugins.Title.Align = "start";

Instance member Color​

Object: Returns or sets the color of the title 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.Title.Color = Color.Navy;

Instance member Display​

Boolean: Returns or sets whether the title is shown (Chart.js display). (Default: False)

Value: true to show the title; otherwise false. The default is false.

Example:

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

Instance member Font​

FontOptions: Returns or sets the font configuration of the title (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.Title.Font.Size = 18;
chart.ChartOptions.Plugins.Title.Font.Weight = "bold";

Instance member Padding​

Int32: Returns or sets the padding, in pixels, applied around the title (Chart.js padding). (Default: 10)

Value: The padding in pixels. The default is 10.

Only the top and bottom padding are applied by Chart.js; the left and right padding are ignored.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Plugins.Title.Padding = 20;

Instance member Position​

String: Returns or sets the position of the title (Chart.js position).

Value: One of "top" | "left" | "bottom" | "right". The default is null, in which case Chart.js uses "top".

Example:

var chart = new ChartJS4();
chart.ChartOptions.Plugins.Title.Position = "bottom";

Instance member Text​

Object: Returns or sets the title text (Chart.js text).

Value: A String, or an array of strings to render the title on multiple lines. The default is null.

The title is only drawn when Display is true.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Plugins.Title.Display = true;
chart.ChartOptions.Plugins.Title.Text = new[] { "Monthly Sales", "2026" };

Methods​

Protected member OnChartChanged()​

Called when the Chart reference changes.

Instance member ResetAlign()​

Resets the Align property to its default value (null).

Used by the designer to restore the default value.

Example:

chart.ChartOptions.Plugins.Title.ResetAlign();

Instance member ResetColor()​

Resets the Color property to its default value (null).

Used by the designer to restore the default value.

Example:

chart.ChartOptions.Plugins.Title.ResetColor();

Instance member ResetDisplay()​

Resets the Display property to its default value (false).

Used by the designer to restore the default value.

Example:

chart.ChartOptions.Plugins.Title.ResetDisplay();

Instance member 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.Title.ResetFont();

Instance member ResetPadding()​

Resets the Padding property to its default value (10).

Used by the designer to restore the default value.

Example:

chart.ChartOptions.Plugins.Title.ResetPadding();

Instance member ResetPosition()​

Resets the Position property to its default value (null).

Used by the designer to restore the default value.

Example:

chart.ChartOptions.Plugins.Title.ResetPosition();

Instance member ResetText()​

Resets the Text property to its default value (null).

Used by the designer to restore the default value.

Example:

chart.ChartOptions.Plugins.Title.ResetText();

Instance member ShouldSerializeAlign()​

Determines whether the Align property should be serialized by the designer.

Returns: Boolean. true if Align is not null; otherwise false.

Used by the designer together with ResetAlign.

Example:

var title = chart.ChartOptions.Plugins.Title;
if (title.ShouldSerializeAlign())
title.ResetAlign();

Instance member 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 title = chart.ChartOptions.Plugins.Title;
if (title.ShouldSerializeColor())
title.ResetColor();

Instance member 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 title = chart.ChartOptions.Plugins.Title;
if (title.ShouldSerializeDisplay())
title.ResetDisplay();

Instance member 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 title = chart.ChartOptions.Plugins.Title;
if (title.ShouldSerializeFont())
title.ResetFont();

Instance member ShouldSerializePadding()​

Determines whether the Padding property should be serialized by the designer.

Returns: Boolean. true if Padding is not 10 (its default); otherwise false.

Used by the designer together with ResetPadding.

Example:

var title = chart.ChartOptions.Plugins.Title;
if (title.ShouldSerializePadding())
title.ResetPadding();

Instance member ShouldSerializePosition()​

Determines whether the Position property should be serialized by the designer.

Returns: Boolean. true if Position is not null; otherwise false.

Used by the designer together with ResetPosition.

Example:

var title = chart.ChartOptions.Plugins.Title;
if (title.ShouldSerializePosition())
title.ResetPosition();

Instance member 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 title = chart.ChartOptions.Plugins.Title;
if (title.ShouldSerializeText())
title.ResetText();