Skip to main content

OptionsScales

Namespace: Wisej.Web.Ext.ChartJS

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

Represents the options for the axes (scales) of the chart.

public class OptionsScales : OptionsBase

Maps to the Chart.js options.scales configuration. The axes are exposed as arrays (xAxes and yAxes) to support charts with multiple axes. An instance is available through the Scales property of the chart options.

Example:

var scales = this.chartJS1.Options.Scales;
scales.xAxes[0].ScaleLabel.LabelString = "Month";
scales.yAxes[0].ScaleLabel.LabelString = "Revenue";
scales.yAxes[0].Ticks.BeginAtZero = true;

Constructors​

Instance member OptionsScales()​

Default constructor.

Creates a set of scale options that is not attached to any chart yet.

Example:

var scales = new OptionsScales();
scales.yAxes[0].Ticks.Max = 100;
this.chartJS1.Options.Scales = scales;

Instance member OptionsScales(owner)​

Constructs a new instance of the OptionsScales set.

NameTypeDescription
ownerOptionsBaseThe OptionsBase set of options that owns this instance.

Example:

var options = (LineOptions)this.chartJS1.Options;
var scales = new OptionsScales(options);
scales.xAxes[0].Display = false;
options.Scales = scales;

Properties​

Instance member xAxes​

OptionScalesAxesX[]: Options for the x-axes.

Value: An array of OptionScalesAxesX objects, one for each x-axis. When not set, the getter creates an array containing a single default x-axis.

Maps to the Chart.js options.scales.xAxes array. To use more than one x-axis, assign a new array and give each axis a unique Id.

Throws:

Example:

var xAxis = this.chartJS1.Options.Scales.xAxes[0];
xAxis.Position = HeaderPosition.Top;
xAxis.GridLines.Display = false;
xAxis.ScaleLabel.LabelString = "Quarter";

Instance member yAxes​

OptionScalesAxesY[]: Options for the y-axes.

Value: An array of OptionScalesAxesY objects, one for each y-axis. When not set, the getter creates an array containing a single default y-axis.

Maps to the Chart.js options.scales.yAxes array. To use more than one y-axis, assign a new array and give each axis a unique Id.

Throws:

Example:

var options = (LineOptions)this.chartJS1.Options;
options.Scales.yAxes = new OptionScalesAxesY[]
{
new OptionScalesAxesY { Id = "sales", Position = HeaderPosition.Left },
new OptionScalesAxesY { Id = "percent", Position = HeaderPosition.Right }
};
options.Scales.yAxes[1].Ticks.Max = 100;