Skip to main content

OptionScalesAxesX

Namespace: Wisej.Web.Ext.ChartJS3

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

Represents the options for the scale X axes.

public class OptionScalesAxesX : OptionScalesAxes

The default Type of an x-axis is Category.

Example:

var xAxis = new OptionScalesAxesX();
xAxis.Position = HeaderPosition.Top;
xAxis.Title.Text = "Product";
this.chartJS31.Options.Scales.xAxes = new[] { xAxis };
this.chartJS31.Update();

Constructors​

Instance member OptionScalesAxesX()​

Default constructor.

Initializes Type to Category.

Example:

var xAxis = new OptionScalesAxesX { Type = ScaleType.Time };
xAxis.Time.Unit = TimeScaleTimeUnit.day;
this.chartJS31.Options.Scales.xAxes = new[] { xAxis };
this.chartJS31.Update();

Instance member OptionScalesAxesX(owner)​

Constructs a new instance of the OptionScalesAxesX set.

NameTypeDescription
ownerOptionsBaseThe OptionsBase set of options that owns this instance.

Initializes Type to Category.

Example:

var scales = this.chartJS31.Options.Scales;
var xAxis = new OptionScalesAxesX(scales);
xAxis.Grid.Display = false;
scales.xAxes = new[] { xAxis };
this.chartJS31.Update();

Properties​

Instance member LabelRotation​

Int32: Returns or sets the rotation of the X Axis labels, in degrees.

Value: Default is 0.

This is a helper property: setting a value greater than 0 sets both MinRotation and MaxRotation of Ticks to the value, so that all labels are rotated by the same angle. Any value other than 0 turns off AutoSkip; 0 turns it back on but leaves the rotation values unchanged. Setting this property updates the chart.

Example:

// rotate the category labels by 45 degrees.
this.chartJS31.ChartType = ChartType.Bar;
this.chartJS31.Options.Scales.xAxes[0].LabelRotation = 45;

Instance member Position​

HeaderPosition: Returns or sets the position of the X axes scale. (Default: Bottom)

Value: One of the HeaderPosition values. Default is Bottom.

Maps to the Chart.js 3 position option of the scale. Use Top or Bottom for an x-axis. Setting this property updates the chart.

Example:

this.chartJS31.Options.Scales.xAxes[0].Position = HeaderPosition.Top;

Instance member Type​

ScaleType: Returns or sets the type of scale being employed. (Default: Category)

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

With Category the axis labels are taken from Labels. Setting this property updates the chart.

Example:

this.chartJS31.ChartType = ChartType.Scatter;
this.chartJS31.Options.Scales.xAxes[0].Type = ScaleType.Linear;