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

set DataPoint.Value in TranckInfoTemplate

4 Answers 19 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nazia
Top achievements
Rank 1
Nazia asked on 30 Aug 2013, 07:32 AM
Hi all,
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

Sort by
0
Accepted
Rosy Topchiyska
Telerik team
answered on 30 Aug 2013, 03:14 PM
Hello Nazia,

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.

Regards,
Rositsa Topchiyska
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Nazia
Top achievements
Rank 1
answered on 02 Sep 2013, 05:17 AM
Thanks Rositsa...
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
0
Accepted
Rosy Topchiyska
Telerik team
answered on 02 Sep 2013, 11:38 AM
Hello Nazia,

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.

0
Nazia
Top achievements
Rank 1
answered on 02 Sep 2013, 11:57 AM
Thanks a lot Rositsa...
Tags
Chart for XAML
Asked by
Nazia
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Nazia
Top achievements
Rank 1
Share this question
or