Skip to main content

OptionScalesAxes

Namespace: Wisej.Web.Ext.ChartJS

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

Represents the options for the scale axes.

public abstract class OptionScalesAxes : OptionsBase

This is the base class of OptionScalesAxesX and OptionScalesAxesY and maps to a single entry in the Chart.js scales.xAxes or scales.yAxes arrays.

Example:

foreach (OptionScalesAxes axis in this.chartJS1.Options.Scales.yAxes)
{
axis.GridLines.Display = false;
axis.Ticks.FontColor = Color.Gray;
}

Constructors​

Instance member OptionScalesAxes()​

Default constructor.

Example:

// OptionScalesAxes is abstract; create one of the derived axis classes.
OptionScalesAxes axis = new OptionScalesAxesY();
axis.Stacked = true;
this.chartJS1.Options.Scales.yAxes = new[] { (OptionScalesAxesY)axis };

Instance member OptionScalesAxes(owner)​

Constructs a new instance of the OptionScalesAxes set.

NameTypeDescription
ownerOptionsBaseThe OptionsBase set of options that owns this instance.

When the owner belongs to a chart of type Pie, Radar, Doughnut or PolarArea, Display is initialized to false.

Example:

var scales = this.chartJS1.Options.Scales;
OptionScalesAxes axis = new OptionScalesAxesX(scales);
axis.Display = true;

Properties​

Instance member BarPercentage​

Single: Percent (0-1) of the available width each bar should be within the category width. (Default: 0.9)

Value: Default is 0.9. A value of 1.0 makes the bars take the whole category width.

Maps to the Chart.js barPercentage option of the axis and applies to bar charts. Changing this property doesn't update the chart automatically; call Update to refresh it.

Example:

var xAxis = ((BarOptions)this.chartJS1.Options).Scales.xAxes[0];
xAxis.BarPercentage = 1.0F;
xAxis.CategoryPercentage = 1.0F;
this.chartJS1.Update();

Instance member CategoryPercentage​

Single: Percent (0-1) of the available width each category should be within the sample width. (Default: 0.8)

Value: Default is 0.8.

Maps to the Chart.js categoryPercentage option of the axis and applies to bar charts.

Example:

// leave more space between the groups of bars.
var xAxis = ((BarOptions)this.chartJS1.Options).Scales.xAxes[0];
xAxis.CategoryPercentage = 0.5F;

Instance member Display​

Boolean: If true, show the scale including grid lines, ticks, and labels. (Default: True)

Value: Default is true. It is initialized to false for pie, radar, doughnut and polar area charts.

Example:

// hide the x-axis completely.
var options = (BarOptions)this.chartJS1.Options;
options.Scales.xAxes[0].Display = false;

Instance member GridLines​

OptionsAxisGridLines: Specifies the configuration of the axis' grid lines.

Value: An OptionsAxisGridLines object with the grid line options.

Maps to the Chart.js gridLines option of the axis.

Example:

var gridLines = this.chartJS1.Options.Scales.yAxes[0].GridLines;
gridLines.DrawBorder = false;
gridLines.BorderDash = new[] { 4, 4 };
gridLines.Color = new[] { Color.LightGray };
this.chartJS1.Update();

Instance member Id​

String: Used to identify the scale options for multi-axes charts. (Default: "")

Value: Default is an empty string.

Maps to the Chart.js id option of the axis. Data sets are bound to an axis using the axis id. Changing this property doesn't update the chart automatically; call Update to refresh it.

Example:

var scales = this.chartJS1.Options.Scales;
scales.yAxes = new[] { new OptionScalesAxesY(), new OptionScalesAxesY() };
scales.yAxes[0].Id = "left-axis";
scales.yAxes[1].Id = "right-axis";
scales.yAxes[1].Position = HeaderPosition.Right;

Instance member ScaleLabel​

OptionsScaleTitle: Options for the title (label) displayed along the axis.

Value: An OptionsScaleTitle object, created on first access.

Maps to the Chart.js scaleLabel option of the axis. The label is shown only when LabelString is not empty.

Throws:

Example:

var label = this.chartJS1.Options.Scales.xAxes[0].ScaleLabel;
label.LabelString = "Day of the week";
label.FontColor = Color.DarkBlue;

Instance member Stacked​

Boolean: When true, the bars are stacked. (Default: False)

Value: Default is false.

Maps to the Chart.js stacked option of the axis. To create a stacked bar chart, set this property to true on both the x-axis and the y-axis.

Example:

var scales = ((BarOptions)this.chartJS1.Options).Scales;
scales.xAxes[0].Stacked = true;
scales.yAxes[0].Stacked = true;

Instance member Ticks​

OptionsScalesTicks: Options for the chart ticks on the axes.

Value: An OptionsScalesTicks object, created on first access.

Maps to the Chart.js ticks option of the axis.

Throws:

Example:

var ticks = ((LineOptions)this.chartJS1.Options).Scales.yAxes[0].Ticks;
ticks.Min = 0;
ticks.Max = 200;
ticks.StepSize = 25;

Instance member Time​

ScaleTime: Options for the time scale type - ignored if not a time scale type.

Value: A ScaleTime object, created on first access.

These options are serialized only when Type is set to Time.

Example:

var xAxis = ((LineOptions)this.chartJS1.Options).Scales.xAxes[0];
xAxis.Type = ScaleType.Time;
xAxis.Time.Unit = TimeScaleTimeUnit.month;
xAxis.Time.TooltipFormat = "MMM YYYY";

Instance member Type​

ScaleType: Type of scale being employed. (Default: Linear)

Value: One of the ScaleType values. Default is Linear.

Maps to the Chart.js type option of the axis. When the type is Time, the Time options are also used.

Example:

// use a logarithmic y-axis.
var yAxis = ((LineOptions)this.chartJS1.Options).Scales.yAxes[0];
yAxis.Type = ScaleType.Logarithmic;

Inherited By​

NameDescription
OptionScalesAxesXRepresents the options for the scale X axes.
OptionScalesAxesYRepresents the options for the scale Y axes.