Crosshair label definition template with chart values

3 posts, 0 answers
  1. Flemming
    Flemming avatar
    13 posts
    Member since:
    Aug 2016

    Posted 07 Sep 2016 Link to this post

    I have a RadCartesianChart with a DateTimeContinuousAxis and a ChartCrosshairBehavior.

    When the vertical line label shows – it displays the date/time. I want to display other data from the chart too – but even when I use a template for the label definition – the only DataContext I can access is the datetime. 

    Is there a way to customize the label definition - to include data from other sources? 

    /Flemming Rosenbrandt


  2. Martin Ivanov
    Martin Ivanov avatar
    1408 posts

    Posted 09 Sep 2016 Link to this post

    Hi Flemming,

    Indeed, the labels of the crosshair know only about the value on the axis that corresponds to the mouse position. In order to get other data from the view model of the chart itself you can use RelativeSource or ElementName binding.
                    <TextBlock Text="{Binding ElementName=chart, Path=DataContext.MyAdditionalInformation}" />

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. Flemming
    Flemming avatar
    13 posts
    Member since:
    Aug 2016

    Posted 12 Sep 2016 in reply to Martin Ivanov Link to this post

    Thanks - I will give it a try.
Back to Top