This is a migrated thread and some comments may be shown as answers.

Discrete moving crosshairs (ChartCrosshairBehavior)

1 Answer 139 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Гоша asked on 23 Dec 2016, 10:16 AM


Could you tell me how to adjust the crosshairs so that it shifted to a discrete value (for example a multiple of 0.25) for the "Y" axis (for example, 1 minute) on the X axis.


<telerik:RadCartesianChart Grid.Row="1" Background="{x:Null}">
                <telerik:LinearAxis x:Name="AxisY" HorizontalLocation="Right" LineThickness="1" SmartLabelsMode="SmartStepAndRange" MajorStep="1"   />
                <telerik:DateTimeCategoricalAxis x:Name="AxisX" LabelFormat="HH:mm"
                                                LabelFitMode="Rotate" SmartLabelsMode="SmartStep"
                                                PlotMode="OnTicksPadded" />
                    HorizontalLineLabelDefinition="{DynamicResource ChartAnnotationLabelDefinitionHorizontal}"
                    VerticalLineLabelDefinition="{DynamicResource ChartAnnotationLabelDefinitionVertical}" PositionChanged="ChartCrosshairBehavior_PositionChanged" />               
            <telerik:CandlestickSeries x:Name="csPrice" ZIndex="1"
                                       ItemsSource="{Binding Candles}"
                                       DefaultVisualStyle="{DynamicResource CandleStikSeriesDefaultStyle}"
                                       DefaultVisualStyleSelector="{Binding Mode=OneWay, Source={StaticResource CandleStikSeriesSelectStyle}}"

1 Answer, 1 is accepted

Sort by
Martin Ivanov
Telerik team
answered on 26 Dec 2016, 11:54 AM
Hi Gosha,

The chart crosshair is designed to follow the mouse and you can't change this behavior. Instead of the crosshair, you can use the trackball behavior which snaps to data points. If this doesn't work for you, it is possible to implement your requirement using chart annotations, the conversion API and mouse events. You can see the TrackBallLikeAnnotations SDK example which will be helpful in this case because it shows how to create an interactive annotation.

Also, there is feature request about implementing trackball-like crosshair behavior which you can find logged in our feedback portal. There you can track its status and vote for an implementation.

Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Asked by
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question