Class ChartTrackBallBehavior
ChartTrackBallBehavior enables tracking of data points nearer to mouse over position or at touch contact point in a Chart.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.UWP.dll
Syntax
public class ChartTrackBallBehavior : ChartBehavior, ICloneable
Remarks
ChartTrackBallBehavior displays a vertical line,a tracker ball symbol and a popup like control displaying information about the data point, at mouse move positions/ at touch contact positions over a ChartSeriesBase.
Examples
This example, we are using ChartTrackBallBehavior.
<syncfusion:SfChart>
<syncfusion:SfChart.Behaviors>
<syncfusion:ChartTrackBallBehavior/>
</syncfusion:SfChart.Behaviors>
</syncfusion:SfChart>
ChartTrackBallBehavior trackball = new ChartTrackBallBehavior();
chartArea.Behaviors.Add(trackball);
Constructors
ChartTrackBallBehavior()
Called when instance created for ChartTrackBallBehavior.
Declaration
public ChartTrackBallBehavior()
Fields
AxisLabelAlignmentProperty
The DependencyProperty for AxisLabelAlignment property.
Declaration
public static readonly DependencyProperty AxisLabelAlignmentProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ChartTrackBallStyleProperty
The DependencyProperty for ChartTrackBallStyle property.
Declaration
public static readonly DependencyProperty ChartTrackBallStyleProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
LabelDisplayModeProperty
The DependencyProperty for LabelDisplayMode property.
Declaration
public static readonly DependencyProperty LabelDisplayModeProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
LabelHorizontalAlignmentProperty
The DependencyProperty for LabelHorizontalAlignment property.
Declaration
public static readonly DependencyProperty LabelHorizontalAlignmentProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
LabelVerticalAlignmentProperty
The DependencyProperty for LabelVerticalAlignment property.
Declaration
public static readonly DependencyProperty LabelVerticalAlignmentProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
LineStyleProperty
The DependencyProperty for LineStyle property.
Declaration
public static readonly DependencyProperty LineStyleProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
ShowLineProperty
The DependencyProperty for ShowLine property.
Declaration
public static readonly DependencyProperty ShowLineProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
UseSeriesPaletteProperty
The DependencyProperty for UseSeriesPalette property.
Declaration
public static readonly DependencyProperty UseSeriesPaletteProperty
Field Value
Type |
---|
Windows.UI.Xaml.DependencyProperty |
Properties
AxisLabelAlignment
Gets or sets the alignment for the label appearing in axis.
Declaration
public ChartAlignment AxisLabelAlignment { get; set; }
Property Value
Type | Description |
---|---|
ChartAlignment |
ChartTrackBallStyle
Gets or sets the style for ChartTrackBallControl.
Declaration
public Style ChartTrackBallStyle { get; set; }
Property Value
Type |
---|
Windows.UI.Xaml.Style |
IsActivated
Gets or sets a value indicating whether the trackball is activated or not.
Declaration
protected bool IsActivated { get; set; }
Property Value
Type |
---|
System.Boolean |
LabelDisplayMode
Gets or sets the trackball display mode for label.
Declaration
public TrackballLabelDisplayMode LabelDisplayMode { get; set; }
Property Value
Type | Description |
---|---|
TrackballLabelDisplayMode |
LabelHorizontalAlignment
Gets or sets horizontal alignment for label.
Declaration
public ChartAlignment LabelHorizontalAlignment { get; set; }
Property Value
Type |
---|
ChartAlignment |
LabelVerticalAlignment
Gets or sets vertical alignment for label.
Declaration
public ChartAlignment LabelVerticalAlignment { get; set; }
Property Value
Type |
---|
ChartAlignment |
LineStyle
Gets or sets the trackball line style.
Declaration
public Style LineStyle { get; set; }
Property Value
Type |
---|
Windows.UI.Xaml.Style |
PointInfos
Gets the collection of ChartPointInfo.
Declaration
public ObservableCollection<ChartPointInfo> PointInfos { get; }
Property Value
Type |
---|
System.Collections.ObjectModel.ObservableCollection<ChartPointInfo> |
ShowLine
Gets or sets a value indicating whether to show/hide line.
Declaration
public bool ShowLine { get; set; }
Property Value
Type |
---|
System.Boolean |
UseSeriesPalette
Gets or sets a value indicating whether to change the color for the labels according to the series color.
Declaration
public bool UseSeriesPalette { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
AddElement(UIElement)
Method implementation for adding UIElement.
Declaration
protected void AddElement(UIElement element)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.UIElement | element | UIElement |
AddGroupLabels()
Method used for adding grouped labels when using LabelDisplayMode was GroupAllPoints.
Declaration
protected virtual void AddGroupLabels()
AddLabel(ChartPointInfo, ChartAlignment, ChartAlignment, DataTemplate)
Mathod implementation for adding labels in trackball.
Declaration
protected void AddLabel(ChartPointInfo obj, ChartAlignment verticalAlignment, ChartAlignment horizontalAlignment, DataTemplate template)
Parameters
Type | Name | Description |
---|---|---|
ChartPointInfo | obj | ChartPointInfo |
ChartAlignment | verticalAlignment | Used to specify ChartAlignment for vertical |
ChartAlignment | horizontalAlignment | Used to specify ChartAlignment for horizontal |
Windows.UI.Xaml.DataTemplate | template | DataTemplate |
AddLabel(Object, ChartAlignment, ChartAlignment, DataTemplate, Double, Double)
Method implementation for adding label in trackball.
Declaration
protected virtual void AddLabel(object obj, ChartAlignment verticalAlignment, ChartAlignment horizontalAlignment, DataTemplate labelTemplate, double x, double y)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | ChartPointInfo |
ChartAlignment | verticalAlignment | Used to specify ChartAlignment for vertical |
ChartAlignment | horizontalAlignment | Used to specify ChartAlignment for horizontal |
Windows.UI.Xaml.DataTemplate | labelTemplate | DataTemplate |
System.Double | x | The X location |
System.Double | y | The Y location |
AddTrackBall(ChartPointInfo)
Method implementation for adding trackBall to corresponding chart point.
Declaration
protected virtual void AddTrackBall(ChartPointInfo pointInfo)
Parameters
Type | Name | Description |
---|---|---|
ChartPointInfo | pointInfo | ChartPointInfo |
AlignDefaultLabel(ChartAlignment, ChartAlignment, Double, Double, ContentControl)
Align the element inside the content control.
Declaration
protected override void AlignDefaultLabel(ChartAlignment verticalAlignemnt, ChartAlignment horizontalAlignment, double x, double y, ContentControl control)
Parameters
Type | Name | Description |
---|---|---|
ChartAlignment | verticalAlignemnt | Used to specify ChartAlignment for vertical |
ChartAlignment | horizontalAlignment | Used to specify ChartAlignment for horizontal |
System.Double | x | The X location |
System.Double | y | The Y location |
Windows.UI.Xaml.Controls.ContentControl | control | Used to specify corresponding content control |
Overrides
AttachElements()
Method implementation for AttachElements.
Declaration
protected override void AttachElements()
Overrides
ClearItems()
Method implementation for clear items in ChartTrackballbehavior.
Declaration
protected void ClearItems()
CloneBehavior(DependencyObject)
Declaration
protected override DependencyObject CloneBehavior(DependencyObject obj)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.DependencyObject | obj |
Returns
Type |
---|
Windows.UI.Xaml.DependencyObject |
Overrides
DetachElements()
Method implementation for DetachElements.
Declaration
protected override void DetachElements()
Overrides
GenerateLabels()
Method implementation to generate the labels for trackball.
Declaration
protected virtual void GenerateLabels()
GenerateTrackBalls()
Method implementation for generate Trackballs.
Declaration
protected virtual void GenerateTrackBalls()
GetYValuesBasedOnValue(Double, ChartSeriesBase)
Return collection of double values from the given ChartSeries.
Declaration
protected IList<double> GetYValuesBasedOnValue(double x, ChartSeriesBase series)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | x position |
ChartSeriesBase | series | chart series |
Returns
Type |
---|
System.Collections.Generic.IList<System.Double> |
OnHolding(HoldingRoutedEventArgs)
Called when holding the focus in UIElement.
Declaration
protected override void OnHolding(HoldingRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.HoldingRoutedEventArgs | e | HoldingRoutedEventArgs |
Overrides
OnLayoutUpdated()
Called when layout updated in chart.
Declaration
protected override void OnLayoutUpdated()
Overrides
OnPointerExited(PointerRoutedEventArgs)
Called when pointer is exited.
Declaration
protected override void OnPointerExited(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
Overrides
OnPointerMoved(PointerRoutedEventArgs)
Called when pointer moved in the chart.
Declaration
protected override sealed void OnPointerMoved(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
Overrides
OnPointerPositionChanged()
Called when pointer position changed in the chart.
Declaration
protected virtual void OnPointerPositionChanged()
OnPointerPositionChanged(Point)
Called when pointer position changed.
Declaration
protected virtual void OnPointerPositionChanged(Point point)
Parameters
Type | Name | Description |
---|---|---|
Windows.Foundation.Point | point | Point |
OnPointerPressed(PointerRoutedEventArgs)
Called when pointer pressed in the chart.
Declaration
protected override void OnPointerPressed(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
Overrides
OnPointerReleased(PointerRoutedEventArgs)
Called when pointer released in the chart.
Declaration
protected override void OnPointerReleased(PointerRoutedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Input.PointerRoutedEventArgs | e | PointerRoutedEventArgs |
Overrides
OnSizeChanged(SizeChangedEventArgs)
Called when size changed.
Declaration
protected override void OnSizeChanged(SizeChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.SizeChangedEventArgs | e | SizeChangedEventArgs |
Overrides
Events
PositionChanged
Event correspond to trackball position changed. It invokes after position changed to new mouse pointer position.
Declaration
public event EventHandler<PositionChangedEventArgs> PositionChanged
Event Type
Type |
---|
System.EventHandler<PositionChangedEventArgs> |
Remarks
PositionChanging
Event correspond to trackball position changing. It invokes before position changing from current position to new mouse position.
Declaration
public event EventHandler<PositionChangingEventArgs> PositionChanging
Event Type
Type |
---|
System.EventHandler<PositionChangingEventArgs> |