how to set DataPoint.Value in TrackInfoTemplate.
I refered this http://www.telerik.com/community/forums/metro/chart-xaml/customize-content-shown-by-charttrackballbehavior.aspx and I am not able to set the DataPoint.Value.
Please guide me.
The requirement is to show the Datapoint value whenever mouse hovers over it.
I can use TooltipBahaviour but in that case how to use the
ChartTrackBallBehavior.IntersectionTemplate that I can display the tooltip with the marker color highlighted?
4 Answers, 1 is accepted
Thank you for using RadControls for Windows 8!
For your convenience, I have attached a runnable sample application that uses ChartTrackBallBehavior with a custom TrackInfoTemplate to visualize the value of the data point. As already stated in the post, the TrackInfoTemplate property is attached per series basis and you have to define it in the concrete series in order to be able to use binding to the series' data points. I have also demonstrated how you can set the ContentTemplate property of the ChartTooltipBehavior - see the commented code in the MainPage.xaml. Please, check if this works for you, and if not, could you elaborate a bit more on the scenario you wish to accomplish.
I look forward to your reply.
Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
The sample code works fine for series other than the series belonging to Scatter category.
Can you please let me know how to apply the same for ScatterPointSeries.
I tried like this
<
telerikChart:ScatterPointSeries
ItemsSource
=
"{Binding Items}"
>
<
telerikChart:ScatterPointSeries.XValueBinding
>
<
telerikChart:PropertyNameDataPointBinding
PropertyName
=
"Category"
/>
</
telerikChart:ScatterPointSeries.XValueBinding
>
<
telerikChart:ScatterPointSeries.YValueBinding
>
<
telerikChart:PropertyNameDataPointBinding
PropertyName
=
"Value"
/>
</
telerikChart:ScatterPointSeries.YValueBinding
>
<
telerikChart:ChartTrackBallBehavior.TrackInfoTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding DataPoint.Value}"
Foreground
=
"Orange"
Margin
=
"20"
/>
</
DataTemplate
>
</
telerikChart:ChartTrackBallBehavior.TrackInfoTemplate
>
</
telerikChart:ScatterPointSeries
>
<
telerikChart:RadCartesianChart.VerticalAxis
>
<
telerikChart:LinearAxis
/>
</
telerikChart:RadCartesianChart.VerticalAxis
>
<
telerikChart:RadCartesianChart.HorizontalAxis
>
<
telerikChart:LinearAxis
/>
</
telerikChart:RadCartesianChart.HorizontalAxis
>
But it does not shows me the Value as in case of Line Series...
Thanks in Advance
When you use ScatterPointSeries, then the DataPoint has two properties - XValue and YValue, instead of Value. In the TrackInfoTemplate you have to set:
<
TextBlock
Text
=
"{Binding DataPoint.XValue}"
Foreground
=
"Orange"
Margin
=
"20"
/>
Or you can use a converter to show both X and Y values. I have modified the example project from my previous answer to show you how.
Hope this helps and, please, let us know if you need further assistance.
Regards,Rositsa Topchiyska
Telerik
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.