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

ChartCrosshairBehavior Label Format in RadCartesianChart

1 Answer 355 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Alessandro
Top achievements
Rank 1
Alessandro asked on 04 Nov 2015, 02:56 PM
Hi,

I'm actually plotting different kind of series (StepLine, Line, Point etc) on a unique rad cartesian chart, where the X axis is a DateTimeContinuousAxis and the Y axis is a LinearAxis. I added to the Chart behavior a ChartCrosshairBehavior control to let the user see both the Y and X values of the points he is pointing to with the mouse.

Since the date time format of the vertical label of the ChartCrosshairBehavior control is not the same of the x axis one (the one of the x axis is "HH:mm", defined by me, while the label one is "dd/mm/yyyy hh:mm", which I suppose was inherited) I was trying to change it, without success. 

How could I change it to "HH:mm"? Is it correct to set the VerticalLineLabelDefinition property format of the ChartCrosshairBehavior control? If yes, how?

Many thanks

Alessandro

1 Answer, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 05 Nov 2015, 12:00 PM
Hi Alessandro,

You can change the label format of both Horizontal or Vertical crosshair behavior's lines by using the ChartAnnotationLabelDeifinition. See the example below:
  <telerik:RadCartesianChart.Behaviors>
    <telerik:ChartCrosshairBehavior>
        <telerik:ChartCrosshairBehavior.HorizontalLineLabelDefinition>
            <telerik:ChartAnnotationLabelDefinition HorizontalAlignment="Right"
                                                    VerticalAlignment="Center"
                                                    Format='{}{0:N1}'>
            </telerik:ChartAnnotationLabelDefinition>
        </telerik:ChartCrosshairBehavior.HorizontalLineLabelDefinition>
    </telerik:ChartCrosshairBehavior>
</telerik:RadCartesianChart.Behaviors>
Hope this helps.

Regards,
Peshito
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Alessandro
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Share this question
or