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

Customize Content Shown by ChartTrackBallBehavior?

6 Answers 126 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.
James
Top achievements
Rank 1
James asked on 06 Mar 2013, 09:38 PM
Using RadChart to display a LineSeries and utilizing ChartTrackBallBehavior to show point details.  How does one go about customizing the content shown by the behavior?  For example, rather than LineSeries as the heading I'd like it to display the Legend Title associated with that LineSeries instead.

6 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 07 Mar 2013, 11:50 AM
Hi James,

Thank you for using our RadControls for Windows 8.

You can control the visual representation of the TrackInfo using the ChartTrackBallBehavior.TrackInfoTemplate property which is attached per Series basis. Here's a sample setup which shows how to extract the Series LegendTitle:

<telerikChart:LineSeries LegendTitle="CustomLegendTitle">
     <telerikChart:ChartTrackBallBehavior.TrackInfoTemplate>
         <DataTemplate>
             <TextBlock Text="{Binding DataPoint.Presenter.LegendTitle}"
                 Foreground="Yellow"/>
         </DataTemplate>
     </telerikChart:ChartTrackBallBehavior.TrackInfoTemplate>
 </telerikChart:LineSeries>

I hope this helps. Let me know if you need further assistance.

All the best,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
James
Top achievements
Rank 1
answered on 08 Mar 2013, 02:59 PM
Thanks for the reply.  Unfortunately, from your answer it's not clear to me how to bind to the DataPoint property.  The Series itself has a DataPoints collection, but I can't find where you are referencing the DataPoint property from.  Could you provide some additional context please.
0
Ivaylo Gergov
Telerik team
answered on 08 Mar 2013, 05:08 PM
Hello James,

Thank you for getting back to us.

The context that ChartTrackBallBehavior receives is of DataPointInfo type. This is a public class which holds information about the current Series and DataPoint. Once you get the current DataPoint through its DataPoint property you receive a CategoricalDataPoint and thus you can get the needed information.
In this chain of thoughts you can get the LegendTitle also using the DataPointInfo.Series property like this:
<telerikChart:ChartTrackBallBehavior.TrackInfoTemplate>
         <DataTemplate>
             <TextBlock Text="{Binding Series.LegendTitle}"/>
         </DataTemplate>
 </telerikChart:ChartTrackBallBehavior.TrackInfoTemplate>


I hope this helps.

Kind regards,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Bill
Top achievements
Rank 1
answered on 02 Sep 2013, 09:35 PM
Hi,

I tried this technique but non point data is being displayed.

<telerik:RadCartesianChart HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Palette="{Binding CustomPalette}">
                  <telerik:RadCartesianChart.Grid>
                      <telerik:CartesianChartGrid MajorLinesVisibility="Y"/>
                  </telerik:RadCartesianChart.Grid>
                  <telerik:RadCartesianChart.VerticalAxis>
                      <telerik:LinearAxis LabelStyle="{StaticResource LabelStyle}" Name="Yards" ShowLabels="True" ></telerik:LinearAxis>
                  </telerik:RadCartesianChart.VerticalAxis>
                  <telerik:RadCartesianChart.HorizontalAxis>
                      <telerik:CategoricalAxis Name="Week" ShowLabels="True"/>
                  </telerik:RadCartesianChart.HorizontalAxis>
                  <telerik:RadCartesianChart.Series>
                      <telerik:AreaSeries ItemsSource="{Binding Totals}" DisplayName="Total Offense"  >
                          <telerik:AreaSeries.ValueBinding>
                              <telerik:PropertyNameDataPointBinding PropertyName="Value"></telerik:PropertyNameDataPointBinding>
                          </telerik:AreaSeries.ValueBinding>
                          <telerik:AreaSeries.CategoryBinding>
                              <telerik:PropertyNameDataPointBinding PropertyName="Name"></telerik:PropertyNameDataPointBinding>
                          </telerik:AreaSeries.CategoryBinding>
                          <telerik:ChartTrackBallBehavior.TrackInfoTemplate>
                              <DataTemplate>
                                  <TextBlock Text="{Binding Series.LegendTitle}" />
                              </DataTemplate>
                          </telerik:ChartTrackBallBehavior.TrackInfoTemplate>
                      </telerik:AreaSeries>
                  </telerik:RadCartesianChart.Series>
                  <telerik:RadCartesianChart.Behaviors>
                      <telerik:ChartTrackBallBehavior InfoMode="Individual" ShowInfo="True" TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated">
                          <telerik:ChartTrackBallBehavior.LineStyle>
                              <Style TargetType="Polyline">
                                  <Setter Property="Fill" Value="Transparent"></Setter>
                              </Style>
                          </telerik:ChartTrackBallBehavior.LineStyle>
                      </telerik:ChartTrackBallBehavior>
                  </telerik:RadCartesianChart.Behaviors>
              </telerik:RadCartesianChart>
0
Bill
Top achievements
Rank 1
answered on 02 Sep 2013, 09:35 PM
Hi,

I tried this technique but no point data is being displayed.

<telerik:RadCartesianChart HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Palette="{Binding CustomPalette}">
                  <telerik:RadCartesianChart.Grid>
                      <telerik:CartesianChartGrid MajorLinesVisibility="Y"/>
                  </telerik:RadCartesianChart.Grid>
                  <telerik:RadCartesianChart.VerticalAxis>
                      <telerik:LinearAxis LabelStyle="{StaticResource LabelStyle}" Name="Yards" ShowLabels="True" ></telerik:LinearAxis>
                  </telerik:RadCartesianChart.VerticalAxis>
                  <telerik:RadCartesianChart.HorizontalAxis>
                      <telerik:CategoricalAxis Name="Week" ShowLabels="True"/>
                  </telerik:RadCartesianChart.HorizontalAxis>
                  <telerik:RadCartesianChart.Series>
                      <telerik:AreaSeries ItemsSource="{Binding Totals}" DisplayName="Total Offense"  >
                          <telerik:AreaSeries.ValueBinding>
                              <telerik:PropertyNameDataPointBinding PropertyName="Value"></telerik:PropertyNameDataPointBinding>
                          </telerik:AreaSeries.ValueBinding>
                          <telerik:AreaSeries.CategoryBinding>
                              <telerik:PropertyNameDataPointBinding PropertyName="Name"></telerik:PropertyNameDataPointBinding>
                          </telerik:AreaSeries.CategoryBinding>
                          <telerik:ChartTrackBallBehavior.TrackInfoTemplate>
                              <DataTemplate>
                                  <TextBlock Text="{Binding Series.LegendTitle}" />
                              </DataTemplate>
                          </telerik:ChartTrackBallBehavior.TrackInfoTemplate>
                      </telerik:AreaSeries>
                  </telerik:RadCartesianChart.Series>
                  <telerik:RadCartesianChart.Behaviors>
                      <telerik:ChartTrackBallBehavior InfoMode="Individual" ShowInfo="True" TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated">
                          <telerik:ChartTrackBallBehavior.LineStyle>
                              <Style TargetType="Polyline">
                                  <Setter Property="Fill" Value="Transparent"></Setter>
                              </Style>
                          </telerik:ChartTrackBallBehavior.LineStyle>
                      </telerik:ChartTrackBallBehavior>
                  </telerik:RadCartesianChart.Behaviors>
              </telerik:RadCartesianChart>
0
Rosy Topchiyska
Telerik team
answered on 04 Sep 2013, 06:25 AM
Hi Bill,

I see that you have not set the LegendTitle property of the AreaSeries.

I hope this helps. Please, let us know if you need further assistance.

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.
Tags
Chart for XAML
Asked by
James
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
James
Top achievements
Rank 1
Bill
Top achievements
Rank 1
Rosy Topchiyska
Telerik team
Share this question
or