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.WPF.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 |
---|
System.Windows.DependencyProperty |
ChartTrackBallStyleProperty
The DependencyProperty for ChartTrackBallStyle property.
Declaration
public static readonly DependencyProperty ChartTrackBallStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
LabelDisplayModeProperty
The DependencyProperty for LabelDisplayMode property.
Declaration
public static readonly DependencyProperty LabelDisplayModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
LabelHorizontalAlignmentProperty
The DependencyProperty for LabelHorizontalAlignment property.
Declaration
public static readonly DependencyProperty LabelHorizontalAlignmentProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
LabelVerticalAlignmentProperty
The DependencyProperty for LabelVerticalAlignment property.
Declaration
public static readonly DependencyProperty LabelVerticalAlignmentProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
LineStyleProperty
The DependencyProperty for LineStyle property.
Declaration
public static readonly DependencyProperty LineStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ShowLineProperty
The DependencyProperty for ShowLine property.
Declaration
public static readonly DependencyProperty ShowLineProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
UseSeriesPaletteProperty
The DependencyProperty for UseSeriesPalette property.
Declaration
public static readonly DependencyProperty UseSeriesPaletteProperty
Field Value
Type |
---|
System.Windows.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 |
---|
System.Windows.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 |
---|
System.Windows.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 |
---|---|---|
System.Windows.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 |
System.Windows.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 |
System.Windows.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 |
System.Windows.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 |
---|---|---|
System.Windows.DependencyObject | obj |
Returns
Type |
---|
System.Windows.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> |
OnLayoutUpdated()
Called when layout updated in chart.
Declaration
protected override void OnLayoutUpdated()
Overrides
OnMouseLeave(MouseEventArgs)
Called when mouse leaved from the chart.
Declaration
protected override void OnMouseLeave(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e | MouseEventArgs |
Overrides
OnMouseLeftButtonDown(MouseButtonEventArgs)
Declaration
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e |
Overrides
OnMouseLeftButtonUp(MouseButtonEventArgs)
Called when mouse left button was released.
Declaration
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseButtonEventArgs | e | MouseButtonEventArgs |
Overrides
OnMouseMove(MouseEventArgs)
Called when mouse moved in the chart.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseEventArgs | e | MouseEventArgs |
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 |
---|---|---|
System.Windows.Point | point | Point |
OnSizeChanged(SizeChangedEventArgs)
Called when size changed.
Declaration
protected override void OnSizeChanged(SizeChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.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> |