Skip to main content

TickOptions

Namespace: Wisej.Web.Ext.ChartJS4.Models

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

Represents the options of the tick labels of an axis (Chart.js scales[id].ticks).

public class TickOptions : OptionsBase

An instance is lazily created by Ticks. Additional Chart.js tick options, such as stepSize, maxTicksLimit, autoSkip or precision, can be supplied through ExtensionData.

Example:

var chart = new ChartJS4();
var ticks = chart.ChartOptions.Scales.X.Ticks;
ticks.Color = System.Drawing.Color.DimGray;
ticks.MaxRotation = 90;
ticks.MinRotation = 45;
ticks.Font.Size = 10;

Constructors​

Instance member TickOptions()​

Initializes a new instance of TickOptions.

Properties​

Instance member Align​

String: Returns or sets the alignment of the tick labels along the axis (Chart.js ticks.align).

Value: One of "start", "center", "end" or "inner", or null (default) to use the Chart.js default ("center").

"inner" aligns the first tick label to the start and the last one to the end of the axis. Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.X.Ticks.Align = "start";

Instance member Color​

Object: Returns or sets the color of the tick labels (Chart.js ticks.color).

Value: A Color, a CSS color string, or an array of colors (one per tick), or null (default) to use the Chart.js default font color.

Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.X.Ticks.Color = "#666666";
chart.ChartOptions.Scales.Y.Ticks.Color = System.Drawing.Color.Navy;

Instance member Display​

Boolean: Returns or sets a value indicating whether the tick labels are displayed (Chart.js ticks.display). (Default: True)

Value: true to show the tick labels; otherwise, false. The default is true.

Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
bool ticksVisible = chart.ChartOptions.Scales.Y.Ticks.Display;

Instance member Font​

FontOptions: Returns or sets the font used to render the tick labels (Chart.js ticks.font).

Value: A FontOptions instance. The getter lazily creates a default instance when none is set.

Changing any of the font values refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.X.Ticks.Font.Family = "Courier New";
chart.ChartOptions.Scales.X.Ticks.Font.Size = 10;

Instance member MaxRotation​

Int32: Returns or sets the maximum rotation, in degrees, of the tick labels when they are rotated to condense labels (Chart.js ticks.maxRotation). (Default: 50)

Value: The maximum rotation angle in degrees. The default is 50.

Rotation only happens when necessary. Applies only to horizontal scales. Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.X.Ticks.MaxRotation = 90;

Instance member MinRotation​

Int32: Returns or sets the minimum rotation, in degrees, of the tick labels (Chart.js ticks.minRotation). (Default: 0)

Value: The minimum rotation angle in degrees. The default is 0.

Applies only to horizontal scales. Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.X.Ticks.MinRotation = 45;

Instance member Mirror​

Boolean: Returns or sets a value indicating whether the tick labels are flipped around the axis, displaying the labels inside the chart area instead of outside (Chart.js ticks.mirror). (Default: False)

Value: true to mirror the labels; otherwise, false. The default is false.

Applies only to vertical scales. Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.Y.Ticks.Mirror = true;

Instance member Padding​

Int32: Returns or sets the padding, in pixels, between the tick labels and the axis (Chart.js ticks.padding). (Default: 3)

Value: The padding in pixels. The default is 3.

When set on a horizontal axis, this applies in the vertical (Y) direction; on a vertical axis, in the horizontal (X) direction. Setting this property refreshes the chart.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.Y.Ticks.Padding = 10;

Methods​

Protected member OnChartChanged()​

Called when the Chart reference changes.

Instance member ResetAlign()​

Resets the Align property to its default value (null).

Example:

var ticks = new TickOptions { Align = "end" };
ticks.ResetAlign();

Instance member ResetColor()​

Resets the Color property to its default value (null).

Example:

var ticks = new TickOptions { Color = "red" };
ticks.ResetColor();

Instance member ResetDisplay()​

Resets the Display property to its default value (true).

Example:

var ticks = new TickOptions();
ticks.ResetDisplay();

Instance member ResetFont()​

Resets the Font property to its default value by discarding the current FontOptions instance.

A new default instance is created the next time Font is read.

Example:

var ticks = new TickOptions();
ticks.Font.Size = 9;
ticks.ResetFont();

Instance member ResetMaxRotation()​

Resets the MaxRotation property to its default value (50).

Example:

var ticks = new TickOptions { MaxRotation = 90 };
ticks.ResetMaxRotation();

Instance member ResetMinRotation()​

Resets the MinRotation property to its default value (0).

Example:

var ticks = new TickOptions { MinRotation = 30 };
ticks.ResetMinRotation();

Instance member ResetMirror()​

Resets the Mirror property to its default value (false).

Example:

var ticks = new TickOptions { Mirror = true };
ticks.ResetMirror();

Instance member ResetPadding()​

Resets the Padding property to its default value (3).

Example:

var ticks = new TickOptions { Padding = 10 };
ticks.ResetPadding();

Instance member ShouldSerializeAlign()​

Determines whether the Align property should be serialized by the designer.

Returns: Boolean. true if Align is not null; otherwise, false.

Used by the Visual Studio designer together with ResetAlign.

Example:

var ticks = new TickOptions();
if (ticks.ShouldSerializeAlign())
ticks.ResetAlign();

Instance member ShouldSerializeColor()​

Determines whether the Color property should be serialized by the designer.

Returns: Boolean. true if Color is not null; otherwise, false.

Used by the Visual Studio designer together with ResetColor.

Example:

var ticks = new TickOptions();
if (ticks.ShouldSerializeColor())
ticks.ResetColor();

Instance member ShouldSerializeDisplay()​

Determines whether the Display property should be serialized by the designer.

Returns: Boolean. true if Display is not true; otherwise, false.

Used by the Visual Studio designer together with ResetDisplay.

Example:

var ticks = new TickOptions();
if (ticks.ShouldSerializeDisplay())
ticks.ResetDisplay();

Instance member ShouldSerializeFont()​

Determines whether the Font property should be serialized by the designer.

Returns: Boolean. true if Font has at least one non-default value; otherwise, false.

Used by the Visual Studio designer together with ResetFont.

Example:

var ticks = new TickOptions();
if (ticks.ShouldSerializeFont())
ticks.ResetFont();

Instance member ShouldSerializeMaxRotation()​

Determines whether the MaxRotation property should be serialized by the designer.

Returns: Boolean. true if MaxRotation is not 50; otherwise, false.

Used by the Visual Studio designer together with ResetMaxRotation.

Example:

var ticks = new TickOptions();
if (ticks.ShouldSerializeMaxRotation())
ticks.ResetMaxRotation();

Instance member ShouldSerializeMinRotation()​

Determines whether the MinRotation property should be serialized by the designer.

Returns: Boolean. true if MinRotation is not 0; otherwise, false.

Used by the Visual Studio designer together with ResetMinRotation.

Example:

var ticks = new TickOptions();
if (ticks.ShouldSerializeMinRotation())
ticks.ResetMinRotation();

Instance member ShouldSerializeMirror()​

Determines whether the Mirror property should be serialized by the designer.

Returns: Boolean. true if Mirror is true; otherwise, false.

Used by the Visual Studio designer together with ResetMirror.

Example:

var ticks = new TickOptions();
if (ticks.ShouldSerializeMirror())
ticks.ResetMirror();

Instance member ShouldSerializePadding()​

Determines whether the Padding property should be serialized by the designer.

Returns: Boolean. true if Padding is not 3; otherwise, false.

Used by the Visual Studio designer together with ResetPadding.

Example:

var ticks = new TickOptions();
if (ticks.ShouldSerializePadding())
ticks.ResetPadding();