Crosshair label definition template with chart values

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

    Posted 07 Sep 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
    Martin avatar
    1099 posts

    Posted 09 Sep 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. UI for WPF is Visual Studio 2017 Ready
  4. Flemming
    Flemming avatar
    12 posts
    Member since:
    Aug 2016

    Posted 12 Sep in reply to Martin Link to this post

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