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).
- C#
- VB.NET
public class OptionsScaleTitle : OptionsBase
Public Class OptionsScaleTitle
Inherits 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
OptionsScaleTitle()
Default constructor.
Example:
var title = new OptionsScaleTitle { LabelString = "Hours" };
this.chartJS1.Options.Scales.xAxes[0].ScaleLabel = title;
OptionsScaleTitle(owner)
Constructs a new instance of the OptionsScaleTitle set.
| Name | Type | Description |
|---|---|---|
| owner | OptionsBase | The 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
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;
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);
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;
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)";