Skip to main content

LineElementOptions

Namespace: Wisej.Web.Ext.ChartJS4.Models

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

Represents the default styling options of the line elements used by line and radar charts (Chart.js options.elements.line).

public class LineElementOptions : OptionsBase

An instance is available through Line. These values apply to all line datasets unless overridden by the dataset options.

Example:

var chart = new ChartJS4();
var line = new LineElementOptions();
line.Tension = 0.4;
line.BorderWidth = 2;
chart.ChartOptions.Elements = new ElementsOptions { Line = line };

Constructors​

Instance member LineElementOptions()​

Initializes a new instance of LineElementOptions.

Properties​

Instance member BackgroundColor​

Object: Returns or sets the default fill color of the area under the lines (Chart.js option backgroundColor).

Value: A Color, a CSS color string, or an array of colors. The default is null, which uses the Chart.js default color.

The area is filled only when the dataset fill option is enabled. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var line = new LineElementOptions();
line.BackgroundColor = "rgba(75, 192, 192, 0.2)";
chart.ChartOptions.Elements = new ElementsOptions { Line = line };

Instance member BorderCapStyle​

String: Returns or sets the cap style of the line ends (Chart.js option borderCapStyle, canvas lineCap).

Value: "butt", "round" or "square", or null (default) to use the Chart.js default ("butt").

Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var line = new LineElementOptions();
line.BorderCapStyle = "round";
chart.ChartOptions.Elements = new ElementsOptions { Line = line };

Instance member BorderWidth​

Int32: Returns or sets the default width, in pixels, of the lines (Chart.js option borderWidth). (Default: 3)

Value: The line width in pixels. The default is 3.

Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var line = new LineElementOptions();
line.BorderWidth = 2;
chart.ChartOptions.Elements = new ElementsOptions { Line = line };

Instance member Tension​

Double: Returns or sets the Bezier curve tension of the lines (Chart.js option tension). (Default: 0)

Value: A value typically between 0 and 1. The default is 0, which draws straight lines.

Values such as 0.4 produce smooth curves. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var line = new LineElementOptions();
line.Tension = 0.4;
chart.ChartOptions.Elements = new ElementsOptions { Line = line };

Methods​

Instance member ResetBackgroundColor()​

Resets the BackgroundColor property to its default value.

Sets BackgroundColor to null. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var line = new LineElementOptions();
line.ResetBackgroundColor();

Instance member ResetBorderCapStyle()​

Resets the BorderCapStyle property to its default value.

Sets BorderCapStyle to null (Chart.js default). This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var line = new LineElementOptions();
line.ResetBorderCapStyle();

Instance member ResetBorderWidth()​

Resets the BorderWidth property to its default value.

Sets BorderWidth to 3. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var line = new LineElementOptions();
line.ResetBorderWidth();

Instance member ResetTension()​

Resets the Tension property to its default value.

Sets Tension to 0. This method is used by the Visual Studio designer and the property grid ("Reset" command).

Example:

var line = new LineElementOptions();
line.ResetTension();

Instance member ShouldSerializeBackgroundColor()​

Returns whether the BackgroundColor property has been changed from its default value and should be serialized by the designer.

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

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (line.ShouldSerializeBackgroundColor())
line.ResetBackgroundColor();

Instance member ShouldSerializeBorderCapStyle()​

Returns whether the BorderCapStyle property has been changed from its default value and should be serialized by the designer.

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

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (line.ShouldSerializeBorderCapStyle())
line.ResetBorderCapStyle();

Instance member ShouldSerializeBorderWidth()​

Returns whether the BorderWidth property has been changed from its default value and should be serialized by the designer.

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

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (line.ShouldSerializeBorderWidth())
line.ResetBorderWidth();

Instance member ShouldSerializeTension()​

Returns whether the Tension property has been changed from its default value and should be serialized by the designer.

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

This method is used by the Visual Studio designer and the property grid to determine whether the property value is persisted in the generated code.

Example:

if (line.ShouldSerializeTension())
line.ResetTension();