Class ChartMouseEventArgs
Specifies the event arguments for mouse-related events in the chart.
Inheritance
Namespace: Syncfusion.Blazor.Toolkit.Charts
Assembly: Syncfusion.Blazor.Toolkit.dll
Syntax
public class ChartMouseEventArgs : BaseEventArgs
Remarks
This class provides comprehensive mouse interaction data including coordinates, chart identification, and axis value mappings for the pointer location.
Properties
AxisData
Gets the axis values of the chart component when mouse events are triggered.
Declaration
public Dictionary<string, object> AxisData { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<System.String, System.Object> | The collection of axes data where the key is the axis name, and the value is the axis values for the location. The default value is null. |
Remarks
This value is read-only and provides information about the axis values for chart interactions.
Examples
<SfChart ChartMouseClick = "MouseClick"> < !--Chart Configuration --> </SfChart> @code { void MouseClick(ChartMouseEventArgs Args) { if (Args.AxisData.TryGetValue("PrimaryXAxis", out object xValue) && Args.AxisData.TryGetValue("PrimaryYAxis", out object yValue)) { AddToDataSource(xValue, yValue); } }
void AddToDataSource(object xValue, object yValue) { // Add the X and Y values to the data source here. } }
ID
Gets the ID of the chart component when mouse events are triggered.
Declaration
public string ID { get; }
Property Value
| Type | Description |
|---|---|
| System.String | The value of the chart component’s id. The default value is chart component’s auto generated id. |
Remarks
It is a read only value.
MouseX
Gets or sets the X coordinate of the mouse pointer.
Declaration
public double MouseX { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | Accepts the double value. |
Remarks
Use this property to retrieve the horizontal position of the mouse pointer relative to the chart.
MouseY
Gets or sets the Y coordinate of the mouse pointer.
Declaration
public double MouseY { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double | Accepts the double value. |
Remarks
Use this property to retrieve the vertical position of the mouse pointer relative to the chart.