Skip to main content

AxisTitleOptions

Namespace: Wisej.Web.Ext.ChartJS4.Models

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

Represents the options of an axis title, the label displayed along an axis (Chart.js scales[id].title).

public class AxisTitleOptions : OptionsBase

An instance is lazily created by Title. The title is hidden by default: set Display to true and assign Text to show it. Additional Chart.js options, such as align, can be supplied through ExtensionData.

Example:

var chart = new ChartJS4();
var title = chart.ChartOptions.Scales.Y.Title;
title.Display = true;
title.Text = "Revenue (USD)";
title.Color = System.Drawing.Color.DarkBlue;
title.Font.Size = 14;

Constructors​

Instance member AxisTitleOptions()​

Initializes a new instance of AxisTitleOptions.

Properties​

Instance member Color​

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

Value: A Color or a CSS color string, or null (default) to use the Chart.js default font color.

Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.Y.Title.Color = "#336699";

Instance member Display​

Boolean: Returns or sets a value indicating whether the axis title is displayed (Chart.js title.display). (Default: False)

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

Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.X.Title.Display = true;
chart.ChartOptions.Scales.X.Title.Text = "Month";

Instance member Font​

FontOptions: Returns or sets the font used to render the axis title (Chart.js title.font).

Value: A FontOptions instance. The getter lazily creates a default instance when none is set.

Changing any of the font values refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.X.Title.Font.Size = 16;
chart.ChartOptions.Scales.X.Title.Font.Weight = "bold";

Instance member Padding​

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

Value: The padding in pixels. The default is 0, which is not serialized so that Chart.js applies its own default (4).

Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.Y.Title.Padding = 10;

Instance member Text​

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

Value: The title text, or null (default) for no text.

The text is shown only when Display is true. Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.Y.Title.Display = true;
chart.ChartOptions.Scales.Y.Title.Text = "Temperature (°C)";

Methods​

Protected member OnChartChanged()​

Called when the Chart reference changes.

Instance member ResetColor()​

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

Example:

var title = new AxisTitleOptions { Color = "gray" };
title.ResetColor();

Instance member ResetDisplay()​

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

Example:

var title = new AxisTitleOptions { Display = true };
title.ResetDisplay();

Instance member ResetFont()​

Resets the Font property to its default value by discarding the current FontOptions instance.

A new default instance is created the next time Font is read.

Example:

var title = new AxisTitleOptions();
title.Font.Size = 18;
title.ResetFont();

Instance member ResetPadding()​

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

Example:

var title = new AxisTitleOptions { Padding = 8 };
title.ResetPadding();

Instance member ResetText()​

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

Example:

var title = new AxisTitleOptions { Text = "Sales" };
title.ResetText();

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 Visual Studio designer together with ResetColor.

Example:

var title = new AxisTitleOptions();
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 true; otherwise, false.

Used by the Visual Studio designer together with ResetDisplay.

Example:

var title = new AxisTitleOptions();
if (title.ShouldSerializeDisplay())
title.ResetDisplay();

Instance member ShouldSerializeFont()​

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

Returns: Boolean. true if Font has at least one non-default value; otherwise, false.

Used by the Visual Studio designer together with ResetFont.

Example:

var title = new AxisTitleOptions();
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 0; otherwise, false.

Used by the Visual Studio designer together with ResetPadding.

Example:

var title = new AxisTitleOptions();
if (title.ShouldSerializePadding())
title.ResetPadding();

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 Visual Studio designer together with ResetText.

Example:

var title = new AxisTitleOptions();
if (title.ShouldSerializeText())
title.ResetText();