menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class ChartTrackBallBehavior - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class ChartTrackBallBehavior

    ChartTrackBallBehavior enables tracking of data points nearer to mouse over position or at touch contact point in a Chart.

    Inheritance
    System.Object
    ChartBehavior
    ChartTrackBallBehavior
    Implements
    ICloneable
    Inherited Members
    ChartBehavior.AdorningCanvas
    ChartBehavior.BottomAdorningCanvas
    ChartBehavior.ChartArea
    ChartBehavior.chartAxis
    ChartBehavior.Clone()
    ChartBehavior.DetachElement(UIElement)
    ChartBehavior.GetYValuesBasedOnIndex(Double, ChartSeriesBase)
    ChartBehavior.OnDoubleTapped(MouseButtonEventArgs)
    ChartBehavior.OnDragEnter(DragEventArgs)
    ChartBehavior.OnDragLeave(DragEventArgs)
    ChartBehavior.OnDragOver(DragEventArgs)
    ChartBehavior.OnDrop(DragEventArgs)
    ChartBehavior.OnGotFocus(RoutedEventArgs)
    ChartBehavior.OnKeyDown(KeyEventArgs)
    ChartBehavior.OnKeyUp(KeyEventArgs)
    ChartBehavior.OnLostFocus(RoutedEventArgs)
    ChartBehavior.OnManipulationCompleted(ManipulationCompletedEventArgs)
    ChartBehavior.OnManipulationDelta(ManipulationDeltaEventArgs)
    ChartBehavior.OnManipulationStarted(ManipulationStartedEventArgs)
    ChartBehavior.OnMouseEnter(MouseEventArgs)
    ChartBehavior.OnMouseWheel(MouseWheelEventArgs)
    ChartBehavior.UpdateArea()
    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

    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

    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
    ChartBehavior.AlignDefaultLabel(ChartAlignment, ChartAlignment, Double, Double, ContentControl)

    AttachElements()

    Method implementation for AttachElements.

    Declaration
    protected override void AttachElements()
    Overrides
    ChartBehavior.AttachElements()

    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
    ChartBehavior.CloneBehavior(DependencyObject)

    DetachElements()

    Method implementation for DetachElements.

    Declaration
    protected override void DetachElements()
    Overrides
    ChartBehavior.DetachElements()

    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
    ChartBehavior.OnLayoutUpdated()

    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
    ChartBehavior.OnMouseLeave(MouseEventArgs)

    OnMouseLeftButtonDown(MouseButtonEventArgs)

    Declaration
    protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Input.MouseButtonEventArgs e
    Overrides
    ChartBehavior.OnMouseLeftButtonDown(MouseButtonEventArgs)

    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
    ChartBehavior.OnMouseLeftButtonUp(MouseButtonEventArgs)

    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
    ChartBehavior.OnMouseMove(MouseEventArgs)

    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
    ChartBehavior.OnSizeChanged(SizeChangedEventArgs)

    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

    PositionChangedEventArgs

    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>
    Remarks

    PositionChangingEventArgs

    Implements

    ICloneable
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved