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.
- C#
- VB.NET
public class OptionsScales : OptionsBase
Public Class OptionsScales
Inherits 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
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;
OptionsScales(owner)
Constructs a new instance of the OptionsScales set.
| Name | Type | Description |
|---|---|---|
| owner | OptionsBase | The 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
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:
- ArgumentNullException The value is null.
- InvalidOperationException An axis in the array already belongs to another set of options.
Example:
var xAxis = this.chartJS1.Options.Scales.xAxes[0];
xAxis.Position = HeaderPosition.Top;
xAxis.GridLines.Display = false;
xAxis.ScaleLabel.LabelString = "Quarter";
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:
- ArgumentNullException The value is null.
- InvalidOperationException An axis in the array already belongs to another set of options.
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;