ToolTip for LineSeries don't show

6 posts, 1 answers
  1. Yang
    Yang avatar
    6 posts
    Member since:
    Mar 2015

    Posted 23 Mar 2015 Link to this post

    Hi,
       The SDK Tooltip example (Telerik xaml-sdk-master\ChartView\WPF\Tooltip) works fine. But if I change the series from bar to line,
    the tooltip will not show again.

    Only change one line:
       <telerik:BarSeries CategoryBinding="Quarter" ValueBinding="Profit" />
    to:
       <telerik:LineSeries CategoryBinding="Quarter" ValueBinding="Profit" />

    So, how can I show simple tooltip on LineSeries or ScatterLineSeries? 

    Thanks.
  2. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    1258 posts

    Posted 24 Mar 2015 Link to this post

    Hello Yang,

    The tooltip behavior of the RadChartView suite depends on the series default visual element which describes its data points. Since the LineSeries doesn't have a default visual presenter for its points a tooltip is not displayed. The first note (the blue paragraph) in the Tooltip help article describes this.

    In order to show a tooltip for the line series you can define a PointTemplate for the LineSeries. For example:
    <telerik:LineSeries.PointTemplate>
        <DataTemplate>
            <Ellipse Width="20" Height="20" Fill="Red" />
        </DataTemplate>
     </telerik:LineSeries.PointTemplate>

    I hope this information helps.

    Regards,
    Martin
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. Yang
    Yang avatar
    6 posts
    Member since:
    Mar 2015

    Posted 24 Mar 2015 in reply to Martin Ivanov Link to this post

    Thank you, Martin:

        The tooltip showed after define PointTemplate. 

    Regards,
     Yang
  4. William
    William avatar
    35 posts
    Member since:
    Sep 2016

    Posted 07 Feb in reply to Martin Ivanov Link to this post

    Martin -

      I'm able to use the XAML you show for plots with a couple of series. How can I do the same thing in the C# for a plot with multiple series added by the user?

  5. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1258 posts

    Posted 08 Feb Link to this post

    Hello William,

    You can define the DataTemplate in the main view or the application resources and get it from the Resource dictionary when the series is created. For example:
    <Window.Resources>
        <DataTemplate x:Key="seriesPointTemplate">
            <Ellipse Width="20" Height="20" Fill="Red" />
        </DataTemplate>
    </Window.Resources>

    series.PointTemplate = (DataTemplate)this.Resources["seriesPointTemplate"];
    // where 'this' is the Window object (for example the MainWindow)

    Or you can create the DataTemplate in code, but this is a bit harder and hard to maintain. You can see how to do that in the following StackOverflow question.

    Regards,
    Martin
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  6. William
    William avatar
    35 posts
    Member since:
    Sep 2016

    Posted 08 Feb in reply to Martin Ivanov Link to this post

    Thank you. That did the trick.
Back to Top