Skip to main content

OptionsScaleTitle

Namespace: Wisej.Web.Ext.ChartJS

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

Represents the options for the scale title (the label displayed along an axis).

public class OptionsScaleTitle : OptionsBase

Maps to the Chart.js scaleLabel option of an axis. Use the ScaleLabel property to access it.

Example:

var title = ((LineOptions)this.chartJS1.Options).Scales.yAxes[0].ScaleLabel;
title.LabelString = "Visitors";
title.Font = new Font("Arial", 12F);

Constructors​

Instance member OptionsScaleTitle()​

Default constructor.

Example:

var title = new OptionsScaleTitle { LabelString = "Hours" };
this.chartJS1.Options.Scales.xAxes[0].ScaleLabel = title;

Instance member OptionsScaleTitle(owner)​

Constructs a new instance of the OptionsScaleTitle set.

NameTypeDescription
ownerOptionsBaseThe OptionsBase set of options that owns this instance.

Example:

var yAxis = this.chartJS1.Options.Scales.yAxes[0];
var title = new OptionsScaleTitle(yAxis);
title.LabelString = "Amount";

Properties​

Instance member Display​

Boolean: Shows or hides the scale title.

Value: Default is true. The getter returns false when LabelString is empty, regardless of the value that was set.

Example:

var title = ((LineOptions)this.chartJS1.Options).Scales.yAxes[0].ScaleLabel;
title.LabelString = "Sales";
// temporarily hide the axis title.
title.Display = false;

Instance member Font​

Font: Font of the scale title. (Default: null)

Value: Default is null. When not set, the getter returns the Font of the chart.

The font is converted on the client to the Chart.js fontSize, fontFamily and fontStyle scale label options.

Example:

var title = ((BarOptions)this.chartJS1.Options).Scales.xAxes[0].ScaleLabel;
title.LabelString = "Region";
title.Font = new Font("Segoe UI", 11F, FontStyle.Italic);

Instance member FontColor​

Color: Color of the scale title. (Default: Color [Empty])

Value: Default is Empty. When not set, the getter returns the ForeColor of the chart.

Example:

var title = ((BarOptions)this.chartJS1.Options).Scales.yAxes[0].ScaleLabel;
title.LabelString = "Units";
title.FontColor = Color.Firebrick;

Instance member LabelString​

String: Text of the scale title. (Default: "")

Value: Default is an empty string. Setting it to null stores an empty string.

Maps to the Chart.js labelString option. The title is displayed only when this text is not empty.

Example:

var scales = ((LineOptions)this.chartJS1.Options).Scales;
scales.xAxes[0].ScaleLabel.LabelString = "Date";
scales.yAxes[0].ScaleLabel.LabelString = "Price (USD)";