ChartCrosshairBehavior Label Format in RadCartesianChart

2 posts, 0 answers
  1. Alessandro
    Alessandro avatar
    1 posts
    Member since:
    Feb 2014

    Posted 04 Nov 2015 Link to this post

    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
  2. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 05 Nov 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top