Class ChartBehavior
The ChartBehavior is the base class for ChartSelectionBehavior, ChartTooltipBehavior, ChartTrackballBehavior, and ChartZoomPanBehavior.
Inheritance
Namespace: Syncfusion.Maui.Toolkit.Charts
Assembly: Syncfusion.Maui.Toolkit.dll
Syntax
public abstract class ChartBehavior : Element
Constructors
ChartBehavior()
Declaration
protected ChartBehavior()
Methods
OnTouchDown(ChartBase, Single, Single)
This method is triggered when a touch event is detected on the chart.
Declaration
protected virtual void OnTouchDown(ChartBase chart, float pointX, float pointY)
Parameters
Type | Name | Description |
---|---|---|
ChartBase | chart | |
System.Single | pointX | |
System.Single | pointY |
Remarks
Use the provided points X and Y to determine the exact location of the touch.
You can use these coordinates to interact with the chart, such as highlighting data points, showing tooltips, or performing other actions.
Example code:
Convert the touch coordinates to value coordinates if needed.
chart.ChartPointToValue(xAxis, pointY);
Show a tooltip with information about the data point.
tooltipBehavior.Show(pointX, pointY);
OnTouchMove(ChartBase, Single, Single)
This method is triggered when a touch point is moved along the touch surface.
Declaration
protected virtual void OnTouchMove(ChartBase chart, float pointX, float pointY)
Parameters
Type | Name | Description |
---|---|---|
ChartBase | chart | |
System.Single | pointX | |
System.Single | pointY |
Remarks
Use the provided points X and Y to determine the exact location of the touch.
You can use these coordinates to define the desired actions to be executed when navigating the touch point across the chart area.
Example code:
Convert the touch coordinates to value coordinates if needed.
chart.ChartPointToValue(xAxis, pointY);
Show a tooltip with information about the data point.
tooltipBehavior.Show(pointX, pointY);
OnTouchUp(ChartBase, Single, Single)
This method is triggered when a touch event comes to an end. It is used to finalize the action initiated by the OnTouchDown(ChartBase, Single, Single).
Declaration
protected virtual void OnTouchUp(ChartBase chart, float pointX, float pointY)
Parameters
Type | Name | Description |
---|---|---|
ChartBase | chart | |
System.Single | pointX | |
System.Single | pointY |
Remarks
Use the provided points X and Y to determine the exact location of the touch.
You can use these coordinates to interact with the chart, such as highlighting data points, hiding tooltips, or performing other actions when the touch is released.
Example code:
Convert the touch coordinates to value coordinates if needed.
chart.ChartPointToValue(xAxis, pointY);
Hide a tooltip with information about the data point.
tooltipBehavior.Hide(pointX, pointY);