Skip to main content

OptionsTitle

Namespace: Wisej.Web.Ext.ChartJS

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

Represents the options for the chart title.

public class OptionsTitle : OptionsBase

Use the Title property to access the title options of a ChartJS control. When not set, the text, font and color of the title are taken from the ChartJS control.

Example:

OptionsTitle title = this.chartJS1.Options.Title;
title.Display = true;
title.Text = "Sales 2024";
title.FontColor = 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.chartJS1.Options.Title = title;

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 ChartJS control that displays the title is resolved through owner .

Example:

var title = new OptionsTitle(this.chartJS1.Options);
title.Text = "Expenses";
this.chartJS1.Options.Title = title;

Properties​

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.

Example:

// hide the chart title.
this.chartJS1.Options.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 ChartJS control. The font is converted on the client into the Chart.js fontSize, fontFamily and fontStyle options.

Example:

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

Instance member FontColor​

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 ChartJS control. Themed colors are resolved on the client.

Example:

var title = this.chartJS1.Options.Title;
title.Text = "Alerts";
title.FontColor = Color.Red;

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.

Example:

var title = this.chartJS1.Options.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 title.position option.

Example:

// display the title below the chart.
this.chartJS1.Options.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 ChartJS control. Assigning null sets the text to an empty string.

Example:

this.chartJS1.Text = "Default Title";

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