Skip to main content

InteractionOptions

Namespace: Wisej.Web.Ext.ChartJS4.Models

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

Represents the Chart.js interaction options (options.interaction) that control how hover and tooltip interactions select chart elements.

public class InteractionOptions : OptionsBase

An instance is available through Interaction.

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.Mode = "index";
interaction.Intersect = false;
interaction.Axis = "x";

Constructors​

Instance member InteractionOptions()​

Initializes a new instance of InteractionOptions.

Properties​

Instance member Axis​

String: Returns or sets which directions are used when calculating distances between the pointer and the elements (Chart.js option axis).

Value: "x", "y", "xy" or "r", or null (default) to use the Chart.js default ("x" for "index" mode, "xy" otherwise).

Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.Mode = "nearest";
interaction.Axis = "x";

Instance member IncludeInvisible​

Boolean: Returns or sets whether points that are outside the chart area are also included when evaluating interactions (Chart.js option includeInvisible). (Default: False)

Value: true to include invisible points; otherwise false. The default is false.

Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.IncludeInvisible = true;

Instance member Intersect​

Boolean: Returns or sets whether the interaction mode applies only when the mouse position intersects an item on the chart (Chart.js option intersect). (Default: True)

Value: true to require intersection; otherwise false. The default is true.

This value is always serialized. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.Intersect = false;

Instance member Mode​

String: Returns or sets which elements appear in the interaction (Chart.js option mode). (Default: null)

Value: One of "point", "nearest", "index", "dataset", "x" or "y", or null (default) to use the Chart.js default ("nearest").

"index" selects the items at the same index in all datasets; "dataset" selects all items of the same dataset; "point" selects all items that intersect the point; "nearest" selects the nearest items; "x" and "y" select the items that intersect along the respective axis. Changing this property refreshes the chart.

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.Mode = "index";
interaction.Intersect = false;

Methods​

Instance member ResetAxis()​

Resets the Axis property to its default value.

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

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.ResetAxis();

Instance member ResetExtensionData()​

Resets the ExtensionData property to its default value.

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

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.ResetExtensionData();

Instance member ResetIncludeInvisible()​

Resets the IncludeInvisible property to its default value.

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

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.ResetIncludeInvisible();

Instance member ResetIntersect()​

Resets the Intersect property to its default value.

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

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.ResetIntersect();

Instance member ResetMode()​

Resets the Mode property to its default value.

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

Example:

var chart = new ChartJS4();
var interaction = chart.ChartOptions.Interaction;
interaction.ResetMode();

Instance member ShouldSerializeAxis()​

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

Returns: Boolean. true if Axis 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 (interaction.ShouldSerializeAxis())
interaction.ResetAxis();

Instance member ShouldSerializeExtensionData()​

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

Returns: Boolean. true if ExtensionData contains at least one entry; 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 (interaction.ShouldSerializeExtensionData())
interaction.ResetExtensionData();

Instance member ShouldSerializeIncludeInvisible()​

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

Returns: Boolean. true if IncludeInvisible is true; 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 (interaction.ShouldSerializeIncludeInvisible())
interaction.ResetIncludeInvisible();

Instance member ShouldSerializeIntersect()​

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

Returns: Boolean. true if Intersect is false; 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 (interaction.ShouldSerializeIntersect())
interaction.ResetIntersect();

Instance member ShouldSerializeMode()​

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

Returns: Boolean. true if Mode 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 (interaction.ShouldSerializeMode())
interaction.ResetMode();