This is a migrated thread and some comments may be shown as answers.

ToolTip for LineSeries don't show

7 Answers 313 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Yang
Top achievements
Rank 1
Yang asked on 23 Mar 2015, 11:11 AM
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.

7 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 24 Mar 2015, 09:42 AM
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.

 
0
Yang
Top achievements
Rank 1
answered on 24 Mar 2015, 10:36 AM
Thank you, Martin:

    The tooltip showed after define PointTemplate. 

Regards,
 Yang
0
William
Top achievements
Rank 1
answered on 07 Feb 2017, 01:58 PM

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?

0
Martin Ivanov
Telerik team
answered on 08 Feb 2017, 02:50 PM
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.
0
William
Top achievements
Rank 1
answered on 08 Feb 2017, 02:53 PM
Thank you. That did the trick.
0
BHUKYA
Top achievements
Rank 1
answered on 21 Nov 2018, 06:28 AM

LineSeries lineSeries = new LineSeries();
                lineSeries.CategoryBinding = new PropertyNameDataPointBinding(XasisFeild);
                lineSeries.ValueBinding = new PropertyNameDataPointBinding(YaxisFeild);
                lineSeries.LegendSettings = new SeriesLegendSettings { Title = YaxisFeild };
                //lineSeries.ToolTip = YaxisFeild;
                lineSeries.ItemsSource = listOfDataToPlot;
                lineSeries.Stroke = SetLineSeriesColor(seriesCount);

                Rectangle rectangle = new Rectangle() { Height = 10, Width = 10 };
                Type type = rectangle.GetType();
                DataTemplate dataTemp = new DataTemplate(type);
               // dataTemp.DataType = type;

                lineSeries.PointTemplate = dataTemp;

return lineSeries;

This is how I'm getting line series and adding it to chart as a child. Still I'm not seeing my tooltip and I'm not able to select points on series. I wanted to select one or range of point based on selection. Doing this in code behind not in XAML. Plz help me with this.

 

0
Martin Ivanov
Telerik team
answered on 23 Nov 2018, 03:10 PM
Hello Bhukya,

The tooltip will display only if you have a visuals for the data points. You can show this by setting PointTemplate or DefaultVisualStyle property of the series. You can see how to create a DataTemplate in code in the following blog post. Also, check the following stackoverflow topic for creating a Style in code.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ChartView
Asked by
Yang
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Yang
Top achievements
Rank 1
William
Top achievements
Rank 1
BHUKYA
Top achievements
Rank 1
Share this question
or