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).
- C#
- VB.NET
public class TickOptions : OptionsBase
Public Class TickOptions
Inherits 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
TickOptions()
Initializes a new instance of TickOptions.
Properties
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";
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;
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;
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;
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;
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;
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;
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
OnChartChanged()
Called when the Chart reference changes.
ResetAlign()
Resets the Align property to its default value (null).
Example:
var ticks = new TickOptions { Align = "end" };
ticks.ResetAlign();
ResetColor()
Resets the Color property to its default value (null).
Example:
var ticks = new TickOptions { Color = "red" };
ticks.ResetColor();
ResetDisplay()
Resets the Display property to its default value (true).
Example:
var ticks = new TickOptions();
ticks.ResetDisplay();
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();
ResetMaxRotation()
Resets the MaxRotation property to its default value (50).
Example:
var ticks = new TickOptions { MaxRotation = 90 };
ticks.ResetMaxRotation();
ResetMinRotation()
Resets the MinRotation property to its default value (0).
Example:
var ticks = new TickOptions { MinRotation = 30 };
ticks.ResetMinRotation();
ResetMirror()
Resets the Mirror property to its default value (false).
Example:
var ticks = new TickOptions { Mirror = true };
ticks.ResetMirror();
ResetPadding()
Resets the Padding property to its default value (3).
Example:
var ticks = new TickOptions { Padding = 10 };
ticks.ResetPadding();
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();
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();
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();
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();
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();
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();
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();
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();