Skip to main content

OptionsTitle

Namespace: Wisej.Web.Ext.ChartJS3

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

Represents the options for the chart title.

public class OptionsTitle : OptionsBase

Use the Title property of Plugins to access the title options of a ChartJS3 control. The options are serialized as the Chart.js 3 plugins.title option. When not set, the text, font and color of the title are taken from the ChartJS3 control.

Example:

OptionsTitle title = this.chartJS31.Options.Plugins.Title;
title.Display = true;
title.Text = "Sales 2024";
title.Color = Color.DarkBlue;

Constructors​

Instance member OptionsTitle()​

Default constructor.

Creates a standalone set of title options that can be assigned to Title.

Example:

var title = new OptionsTitle();
title.Text = "Inventory";
title.Position = HeaderPosition.Bottom;

this.chartJS31.Options.Plugins.Title = title;
this.chartJS31.Options.Update();

Instance member OptionsTitle(owner)​

Constructs a new instance of the OptionsTitle set.

NameTypeDescription
ownerOptionsBaseThe OptionsBase set of options that owns this set of options.

The ChartJS3 control that displays the title is resolved through owner . The instance can be assigned only to the option set specified in owner .

Example:

var plugins = this.chartJS31.Options.Plugins;
var title = new OptionsTitle(plugins);
title.Text = "Expenses";

plugins.Title = title;
plugins.Update();

Properties​

Instance member Color​

Color: Returns or sets the title color. (Default: Color [Empty])

Value: The Color of the title text. The default is Empty.

When the value is Empty, the property returns the ForeColor of the owner ChartJS3 control. Serialized as the Chart.js 3 plugins.title.color option; themed colors are resolved on the client. Changing the value calls Update.

Example:

var title = this.chartJS31.Options.Plugins.Title;
title.Text = "Alerts";
title.Color = Color.Red;

Instance member Display​

Boolean: Returns or sets whether the title block is shown. (Default: True)

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

Serialized as the Chart.js 3 plugins.title.display option. Changing the value calls Update.

Example:

// hide the chart title.
this.chartJS31.Options.Plugins.Title.Display = false;

Instance member Font​

Font: Returns or sets the font of the title. (Default: null)

Value: The Font used to render the title. The default is null.

When the value is null, the property returns the Font of the owner ChartJS3 control. The font is converted on the client into the Chart.js 3 font object with the size, family and style fields. Changing the value calls Update.

Example:

this.chartJS31.Options.Plugins.Title.Font = new Font("Segoe UI", 16, FontStyle.Bold);

Instance member Padding​

Int32: Returns or sets the number of pixels to add above and below the title text. (Default: 10)

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

Serialized as the Chart.js 3 plugins.title.padding option. Changing the value calls Update.

Example:

var title = this.chartJS31.Options.Plugins.Title;
title.Text = "Weekly Downloads";
title.Padding = 20;

Instance member Position​

HeaderPosition: Returns or sets the position of the title. (Default: Top)

Value: One of the HeaderPosition values. The default is Top.

Serialized as the Chart.js 3 plugins.title.position option. Changing the value calls Update.

Example:

// display the title below the chart.
this.chartJS31.Options.Plugins.Title.Position = HeaderPosition.Bottom;

Instance member Text​

String: Returns or sets the title text.

Value: The text displayed in the title.

When the text is null or empty, the property returns the Text of the owner ChartJS3 control. Assigning null sets the text to an empty string. Changing the value calls Update.

Example:

this.chartJS31.Text = "Default Title";

// overrides the text of the control.
this.chartJS31.Options.Plugins.Title.Text = "Revenue by Quarter";