This question is locked. New answers and comments are not allowed.
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
0
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:
Ivaylo Gergov
the Telerik team
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
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:
Ivaylo Gergov
the Telerik team
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.
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.
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
Hi Bill,
Rositsa Topchiyska
Telerik
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.
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.