RadCartesianChart tooltip template

6 posts, 0 answers
  1. Tinja
    Tinja avatar
    3 posts
    Member since:
    Apr 2013

    Posted 18 Sep 2013 Link to this post

    Hi!
    I have tried to create a custom template for a tooltip and I've implemented a simple template with custom context. However I realized that the tooltip displays only one series' values in the ClosestDataPoint. While debugging this I noticed that all the DataPointInfos had the same DistanceToTouchLocation, and I assume this is the reason why the ClosestDataPoint's series is always the same.

    I was wondering if there's a solution for this.

    - Tinja

    In the ChartTooltipBehavior I've defined the TriggerMode to be Hold and SnapToClosestPoint is set to true.
    Here's my implementation of the template and the ContextNeeded event handler:
            <telerikChart:RadCartesianChart.TooltipTemplate>
    <DataTemplate>
    <Grid>
    <Grid.RowDefinitions>
     <RowDefinition/>
     <RowDefinition/>
    </Grid.RowDefinitions>
    <TextBlock Text="{Binding Path=Header}"/>
    <TextBlock Text="{Binding Path=Content}" Grid.Row="1"/>
    </Grid>
    </DataTemplate>
    </telerikChart:RadCartesianChart.TooltipTemplate>

    private
    void ChartTooltipBehavior_ContextNeeded(object sender, TooltipContextNeededEventArgs e)
            {
     
                e.Context = new CustomTooltipContext()
                                {
                                    Header = e.DefaultContext.ClosestDataPoint.Series.DisplayName,
                                    Content = e.DefaultContext.ClosestDataPoint.DisplayContent.ToString()
                                };
            }
  2. Rosy Topchiyska
    Admin
    Rosy Topchiyska avatar
    550 posts

    Posted 23 Sep 2013 Link to this post

    Hi Tinja,

    Thank you for your question.

    The distance to the data point is calculated as the horizontal distance between the point and the touch location. This is why all closest points from the series have the same DistanceToTouchLocation
    and ClosestDataPoint is always from the first series. Each DataPoint in the DefaultContext.DataPointInfos has LayoutSlot property that provides information about the position of the data point. Using this information, you can calculate which one is the nearest point.

    I hope this was useful and, please, let us know if you have further questions.

    Regards,
    Rositsa Topchiyska
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. David Renza
    David Renza avatar
    13 posts
    Member since:
    May 2010

    Posted 10 Oct 2013 Link to this post

    Hi,

    in version for WPF (version 2013.2.724.45) is same behavior described by Tinja, but no LayoutSlot property is available. Is there a way how to find really closest data point in WPF? Thanks.

    David
  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 15 Oct 2013 Link to this post

    Hello David,

    Unfortunately the charting components for WPF and Windows8 are different and their implementation is build around the specifics of each of the frameworks. This is why it would be better to further describe your scenario and current implementation in a ticket or a forum thread targeting RadChart(View) for WPF.

    Also, please note that in WPF we provide two different charting components - RadChart and RadChartView. The RadChartView is the latest implementation of our charting components and its advantages are further described in this article.

    Having the above in mind, please create a ticket/forum thread targeting the charting component you're currently using and describe your scenario and the implementation you have in place. As in WPF we don't have a ContextNeeded event and a LayoutSlot property, your description will help us better understand your requirements and advice you how to implement them.

    Regards,
    Tina Stancheva
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Sumit
    Sumit avatar
    1 posts
    Member since:
    Mar 2015

    Posted 08 Jul 2015 Link to this post

      Your All Suggestions And Link Are Bad.........
  7. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 10 Jul 2015 Link to this post

    Hello Sumit,

    Can you please tell us why do you think that the suggestions and link are not okay? If you point out the things that concerns you we might be able to give you additional information on the matter.

    Regards,
    Martin
    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
Back to Top
DevCraft banner