OptionScalesAxesX
Namespace: Wisej.Web.Ext.ChartJS3
Assembly: Wisej.Web.Ext.ChartJS3 (4.1.0.0)
Represents the options for the scale X axes.
- C#
- VB.NET
public class OptionScalesAxesX : OptionScalesAxes
Public Class OptionScalesAxesX
Inherits 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
OptionScalesAxesX()
Default constructor.
Example:
var xAxis = new OptionScalesAxesX { Type = ScaleType.Time };
xAxis.Time.Unit = TimeScaleTimeUnit.day;
this.chartJS31.Options.Scales.xAxes = new[] { xAxis };
this.chartJS31.Update();
OptionScalesAxesX(owner)
Constructs a new instance of the OptionScalesAxesX set.
| Name | Type | Description |
|---|---|---|
| owner | OptionsBase | The OptionsBase set of options that owns this instance. |
Example:
var scales = this.chartJS31.Options.Scales;
var xAxis = new OptionScalesAxesX(scales);
xAxis.Grid.Display = false;
scales.xAxes = new[] { xAxis };
this.chartJS31.Update();
Properties
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;
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;
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;