Skip to main content

ScalesOptions

Namespace: Wisej.Web.Ext.ChartJS4.Models

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

Scales options (Chart.js options.scales).

public class ScalesOptions : OptionsBase

Configures the x and y axes of cartesian charts through X and Y, which are created lazily on first access. Additional axes (e.g. a secondary y1 axis, or the radial r scale of radar and polar area charts) can be supplied through ExtensionData. An instance is obtained from Scales.

Example:

var chart = new ChartJS4();
var scales = chart.ChartOptions.Scales;
scales.X.Title.Display = true;
scales.X.Title.Text = "Month";
scales.Y.Min = 0;
scales.Y.SuggestedMax = 100;

Constructors​

Instance member ScalesOptions()​

Initializes a new instance of ScalesOptions.

Properties​

Instance member X​

AxisOptions: Returns or sets the X axis configuration.

Value: An AxisOptions instance. The getter never returns null: a new instance is created on first access. Serialized as the Chart.js scales.x option through XForSerialization.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.X.Display = true;
chart.ChartOptions.Scales.X.Stacked = true;

Instance member Y​

AxisOptions: Returns or sets the Y axis configuration.

Value: An AxisOptions instance. The getter never returns null: a new instance is created on first access. Serialized as the Chart.js scales.y option through YForSerialization.

Example:

var chart = new ChartJS4();
chart.ChartOptions.Scales.Y.Min = 0;
chart.ChartOptions.Scales.Y.Max = 100;
chart.ChartOptions.Scales.Y.Position = "right";

Methods​

Protected member OnChartChanged()​

Called when the Chart reference changes.

Instance member ResetX()​

Resets the X property by discarding the current X axis options.

A new default AxisOptions instance is created on the next access to X. Used by the Visual Studio designer when the user resets the property.

Example:

chart.ChartOptions.Scales.ResetX();

Instance member ResetY()​

Resets the Y property by discarding the current Y axis options.

A new default AxisOptions instance is created on the next access to Y. Used by the Visual Studio designer when the user resets the property.

Example:

chart.ChartOptions.Scales.ResetY();

Instance member ShouldSerializeX()​

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

Returns: Boolean. true if the X axis options were created and contain non-default values; otherwise false.

Used by the Visual Studio designer to decide whether to generate code for the property. Does not create the lazy instance.

Example:

if (scales.ShouldSerializeX())
scales.ResetX();

Instance member ShouldSerializeY()​

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

Returns: Boolean. true if the Y axis options were created and contain non-default values; otherwise false.

Used by the Visual Studio designer to decide whether to generate code for the property. Does not create the lazy instance.

Example:

if (scales.ShouldSerializeY())
scales.ResetY();