Class ChartTrackballBehavior
Enables the trackball in the Syncfusion.Maui.Charts.ChartTrackballBehavior.CartesianChart.
Namespace: Syncfusion.Maui.Charts
Assembly: Syncfusion.Maui.Charts.dll
Syntax
public class ChartTrackballBehavior : ChartBehavior, IMarkerDependent, IThemeElement
Constructors
ChartTrackballBehavior()
Initializes a new instance of the ChartTrackballBehavior class.
Declaration
public ChartTrackballBehavior()
Fields
ActivationModeProperty
Identifies the ActivationMode bindable property.
Declaration
public static readonly BindableProperty ActivationModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
DisplayModeProperty
Identifies the DisplayMode bindable property.
Declaration
public static readonly BindableProperty DisplayModeProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LabelStyleProperty
Identifies the LabelStyle bindable property.
Declaration
public static readonly BindableProperty LabelStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
LineStyleProperty
Identifies the LineStyle bindable property.
Declaration
public static readonly BindableProperty LineStyleProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
MarkerSettingsProperty
Identifies the MarkerSettings bindable property.
Declaration
public static readonly BindableProperty MarkerSettingsProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowLabelProperty
Identifies the ShowLabel bindable property.
Declaration
public static readonly BindableProperty ShowLabelProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowLineProperty
Identifies the ShowLine bindable property.
Declaration
public static readonly BindableProperty ShowLineProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
ShowMarkersProperty
Identifies the ShowMarkers bindable property.
Declaration
public static readonly BindableProperty ShowMarkersProperty
Field Value
Type |
---|
Microsoft.Maui.Controls.BindableProperty |
Properties
ActivationMode
Gets or sets the value that indicates whether to activate trackball based on the specified touch mode.
Declaration
public ChartTrackballActivationMode ActivationMode { get; set; }
Property Value
Type | Description |
---|---|
ChartTrackballActivationMode | It accepts ChartTrackballActivationMode values, with the default value being TouchMove for Windows and Mac, and LongPress for Android and iOS. |
Remarks
On Windows, LongPress gesture is supported only through touch input, not with a mouse. Consequently, when ActivationMode is set to LongPress, the trackball activates only via touch interaction, not with a mouse interaction.
Examples
<chart:SfCartesianChart>
<!--omitted for brevity-->
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior ActivationMode="TouchMove"/>
</chart:SfCartesianChart.TrackballBehavior>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"/>
</chart:SfCartesianChart>
DisplayMode
Gets or sets display mode of trackball labels.
By default, labels for all the series under the current point index value will be shown.
Declaration
public LabelDisplayMode DisplayMode { get; set; }
Property Value
Type | Description |
---|---|
LabelDisplayMode | Defaults to FloatAllPoints |
Examples
<chart:SfCartesianChart>
<!--omitted for brevity-->
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior DisplayMode="NearestPoint"/>
</chart:SfCartesianChart.TrackballBehavior>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"/>
</chart:SfCartesianChart>
LabelStyle
Gets or sets the value to customize the appearance of trackball labels.
Declaration
public ChartLabelStyle LabelStyle { get; set; }
Property Value
Type |
---|
ChartLabelStyle |
Remarks
To customize the trackball label appearance, you need to create an instance of the ChartLabelStyle class and set to the LabelStyle property.
Null values are invalid.
Examples
<chart:SfCartesianChart>
<!--omitted for brevity-->
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior>
<chart:ChartTrackballBehavior.LabelStyle>
<chart:ChartLabelStyle TextColor="Red" FontSize="14"/>
</chart:ChartTrackballBehavior.LabelStyle>
</chart:ChartTrackballBehavior>
</chart:SfCartesianChart.TrackballBehavior>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"/>
</chart:SfCartesianChart>
LineStyle
Gets or sets the value to customize the appearance of the trackball line.
Declaration
public ChartLineStyle LineStyle { get; set; }
Property Value
Type |
---|
ChartLineStyle |
Remarks
To customize the trackball line appearance, you need to create an instance of the ChartLineStyle class and set to the LineStyle property.
Null values are invalid.
Examples
<chart:SfCartesianChart>
<!--omitted for brevity-->
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior>
<chart:ChartTrackballBehavior.LineStyle>
<chart:ChartLineStyle Stroke = "Red" StrokeWidth="2"/>
</chart:ChartTrackballBehavior.LineStyle>
</chart:ChartTrackballBehavior>
</chart:SfCartesianChart.TrackballBehavior>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"/>
</chart:SfCartesianChart>
MarkerSettings
Gets or sets the option for customize the trackball markers.
Declaration
public ChartMarkerSettings MarkerSettings { get; set; }
Property Value
Type |
---|
ChartMarkerSettings |
Examples
<chart:SfCartesianChart>
<!--omitted for brevity-->
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior>
<chart:ChartTrackballBehavior.MarkerSettings>
<chart:ChartMarkerSettings Height = "10" Width="10" Fill="Red"/>
</chart:ChartTrackballBehavior.MarkerSettings>
</chart:ChartTrackballBehavior>
</chart:SfCartesianChart.TrackballBehavior>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"/>
</chart:SfCartesianChart>
ShowLabel
Gets or sets the value that indicates whether to show label for the trackball.
Declaration
public bool ShowLabel { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Examples
<chart:SfCartesianChart>
<!--omitted for brevity-->
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior ShowLabel="False"/>
</chart:SfCartesianChart.TrackballBehavior>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"/>
</chart:SfCartesianChart>
ShowLine
Gets or sets the value that indicates whether to show the trackball line.
Declaration
public bool ShowLine { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
<chart:SfCartesianChart>
<!--omitted for brevity-->
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior ShowLine="False"/>
</chart:SfCartesianChart.TrackballBehavior>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"/>
</chart:SfCartesianChart>
ShowMarkers
Gets or sets the value that indicates whether to show markers for the trackball.
Declaration
public bool ShowMarkers { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
<chart:SfCartesianChart>
<!--omitted for brevity-->
<chart:SfCartesianChart.TrackballBehavior>
<chart:ChartTrackballBehavior ShowMarkers="False"/>
</chart:SfCartesianChart.TrackballBehavior>
<chart:LineSeries ItemsSource="{Binding Data}"
XBindingPath="XValue"
YBindingPath="YValue"/>
</chart:SfCartesianChart>
Methods
Hide()
Hides the trackball that is visible in the chart.
Declaration
public void Hide()
LabelsGenerated(List<TrackballPointInfo>)
Invokes when the trackball is moved from one data point to another. This helps to customize the trackball label and marker based on the condition.
Declaration
protected virtual void LabelsGenerated(List<TrackballPointInfo> pointInfos)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<TrackballPointInfo> | pointInfos |
OnBindingContextChanged()
Declaration
protected override void OnBindingContextChanged()
OnTouchDown(ChartBase, Single, Single)
Declaration
protected override void OnTouchDown(ChartBase chart, float pointX, float pointY)
Parameters
Type | Name | Description |
---|---|---|
ChartBase | chart | |
System.Single | pointX | |
System.Single | pointY |
Overrides
OnTouchMove(ChartBase, Single, Single)
Declaration
protected override void OnTouchMove(ChartBase chart, float pointX, float pointY)
Parameters
Type | Name | Description |
---|---|---|
ChartBase | chart | |
System.Single | pointX | |
System.Single | pointY |
Overrides
OnTouchUp(ChartBase, Single, Single)
Declaration
protected override void OnTouchUp(ChartBase chart, float pointX, float pointY)
Parameters
Type | Name | Description |
---|---|---|
ChartBase | chart | |
System.Single | pointX | |
System.Single | pointY |
Overrides
Show(Single, Single)
Activate the trackball at the nearest point to the specified location.
Declaration
public void Show(float pointX, float pointY)
Parameters
Type | Name | Description |
---|---|---|
System.Single | pointX | |
System.Single | pointY |