http://www.telerik.com/help/winforms/chartview-features-legend.html
How do I get this to work in Silverlight
<
telerik:RadPieChart
x:Name
=
"PieChartStockValue"
Palette
=
"Metro"
>
<telerik:PieSeries
ShowLabels
=
"True"
RadiusFactor
=
"0.7"
ValueBinding
=
"StockValue"
ItemsSource
=
"{Binding}"
>
<telerik:PieSeries.LabelDefinitions>
<telerik:ChartSeriesLabelDefinitionMargin="-30,0,0,0"/>
</telerik:PieSeries.LabelDefinitions>
<telerik:PieSeries.AngleRange>
<telerik:AngleRange
SweepAngle
=
"360"
/>
</telerik:PieSeries.AngleRange>
</telerik:PieSeries>
</telerik:RadPieChart>
9 Answers, 1 is accepted
The Legend feature is currently available only for the WinForms version of the ChartView. We are planning to add support for integrated ChartLegend control with the Q1 2013 release to the WPF/Silverlight versions.
Regards,
Petar Kirov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
this is an important feature! Is there already a date for the Q1 2013 release?
Thanks a lot and a happy new year,
Tim.
The Q1 2013 version of our controls is expected to be released in mid-February.
Kind regards,
Petar Kirov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks a lot and cheers,
Tim.
Here you can find the release notes for the last release.
Basically this how the RadLegend can be used:
<
Grid
>
<
telerik:RadPieChart
x:Name
=
"chart"
Palette
=
"Windows8"
HoverMode
=
"FadeOtherItems"
>
<
telerik:PieSeries
>
<
telerik:PieSeries.LegendSettings
>
<
telerik:DataPointLegendSettings
/>
</
telerik:PieSeries.LegendSettings
>
<
telerik:PieSeries.DataPoints
>
<
telerik:PieDataPoint
Value
=
"5"
Label
=
"Item 1"
/>
<
telerik:PieDataPoint
Value
=
"3"
Label
=
"Item 2"
/>
<
telerik:PieDataPoint
Value
=
"8"
Label
=
"Item 3"
/>
<
telerik:PieDataPoint
Value
=
"1"
Label
=
"Item 4"
/>
<
telerik:PieDataPoint
Value
=
"12"
Label
=
"Item 5"
/>
</
telerik:PieSeries.DataPoints
>
</
telerik:PieSeries
>
</
telerik:RadPieChart
>
<
telerik:RadLegend
Items
=
"{Binding ElementName=chart, Path=LegendItems}"
HorizontalAlignment
=
"Left"
VerticalAlignment
=
"Top"
HoverMode
=
"FadeOtherItems"
/>
</
Grid
>
I have attached a screenshot of the result, where you can see how the hover mode FadeOtherItems works across the two controls.
All the best,
Petar Kirov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
that's good news! Thanks a lot for your update and the detailed answer!
Cheers,
Tim.
it seems that synchronization is not working properly. Example:
<
telerik:RadPieChart
x:Name
=
"chart"
>
<
telerik:PieSeries
ItemsSource
=
"{Binding List}"
ShowLabels
=
"False"
SliceStyleSelector
=
"{StaticResource pieSliceStyleSelector}"
ValueBinding
=
"Value"
>
<
telerik:PieSeries.LegendSettings
>
<
telerik:DataPointLegendSettings
/>
</
telerik:PieSeries.LegendSettings
>
</
telerik:PieSeries
>
</
telerik:RadPieChart
>
<
telerik:RadLegend
Grid.Column
=
"1"
BorderBrush
=
"{StaticResource dialogItemBackground}"
BorderThickness
=
"1"
Items
=
"{Binding LegendItems, ElementName=chart}"
ItemTemplate
=
"{StaticResource legendItemTemplate}"
/>
and legend item template
<
DataTemplate
x:Key
=
"legendItemTemplate"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Border
Background
=
"{Binding Presenter.DataItem.Color, Mode=OneWay, Converter={StaticResource chartItemColorToBrushConverter}}"
Width
=
"10"
Height
=
"10"
Margin
=
"5"
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Center"
/>
<
TextBlock
Text
=
"{Binding Presenter.DataItem.Label, Mode=OneWay}"
/>
</
StackPanel
>
</
DataTemplate
>
I tried to keep things simple here and clear, so the reason why I am using Color property and color to brush converter (not to involve item types). List can contain variable number of items, and with different labels. This means that na new list can be recreated, which will contain new values. PieChart has no problem displaying the new values, but Radlegend behaves strangely. Example:
List = new ObservableCollection<
ChartEntity
>();
List.Add(new ChartEntity { Label = "ItemA", Value = 10, Color = Colors.Green }),
List.Add new ChartEntity { Label = "ItemB", Value = 6, Color = Colors.Orange });
Both Pie and Legend show two slices, ItemA is displayed in Green color, Iteb in Orange color. All is OK. Then we update the list:
List = new ObservableCollection<
ChartEntity
>();
// or List.Clear();
List.Add(new ChartEntity { Label = "ItemC", Value = 15, Color = Colors.Gray }),
On Pie, there is only one item displayed (ItemC), in Gray color - correct. Legend still shows two items, named ItemC and ItemB (!). The color for ItemC is.gray.
Why RadLegend at this point does not show only ItemC, as Pie does, but also shows ItemB?
Regards,
Goran
I have managed to reproduce this bug. I have logged it in our Public Issue Tracker on this link. There you can vote the PITS item and follow its progress.
Thanks for reporting. I have updated your Telerik points.
Kind regards,
Petar Kirov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.