I would like to set the colors for my pie chart dynamically based on the categories of data available. The RadPieChart.Palette property seems a solution for this, as its bindable and the custom bound colors are indeed picked up by the control as expected. So far so good. However, when enabling label rendering via the ShowLabels property, rendering of the labels becomes problematic. See picture.
Example code (fragment):
01.
<
ListView.Header
>
02.
<
Grid
IsVisible
=
"{Binding ListSource, Converter={StaticResource ItemsSourceNotEmptyConverter}}"
>
03.
<
Grid.RowDefinitions
>
04.
<
RowDefinition
Height
=
"3*"
/>
05.
<
RowDefinition
Height
=
"*"
/>
06.
</
Grid.RowDefinitions
>
07.
08.
<
StackLayout
Margin
=
"0,5,0,0"
Orientation
=
"Vertical"
>
09.
10.
<
Label
11.
HorizontalTextAlignment
=
"Center"
12.
Style
=
"{StaticResource DefaultCaptionStyle}"
13.
Text
=
"{i18n:Translate verrichtingCategoryCounts}"
/>
14.
15.
<
telerikChart:RadPieChart
16.
x:Name
=
"chart"
BackgroundColor
=
"Transparent"
17.
Palette
=
"{Binding ChartPalette}"
>
18.
<
telerikChart:RadPieChart.Series
>
19.
<
telerikChart:PieSeries
20.
ItemsSource
=
"{Binding ChartDataSeries}"
21.
LegendTitleBinding
=
"Legend"
ShowLabels
=
"True"
>
22.
<
telerikChart:PieSeries.ValueBinding
>
23.
<
telerikChart:PropertyNameDataPointBinding
PropertyName
=
"Value"
/>
24.
</
telerikChart:PieSeries.ValueBinding
>
25.
</
telerikChart:PieSeries
>
26.
</
telerikChart:RadPieChart.Series
>
27.
</
telerikChart:RadPieChart
>
28.
</
StackLayout
>
29.
30.
<
ScrollView
Grid.Row
=
"1"
>
31.
<
telerikChart:RadLegend
32.
x:Name
=
"chartLegend"
Margin
=
"8,0,8,8"
33.
LegendItemFontSize
=
"{extensions:FontSize Small}"
34.
LegendProvider
=
"{x:Reference Name=chart}"
35.
Orientation
=
"Vertical"
>
36.
<
telerikChart:RadLegend.LegendItemIconSize
>
37.
<
Size
Width
=
"6"
Height
=
"6"
/>
38.
</
telerikChart:RadLegend.LegendItemIconSize
>
39.
</
telerikChart:RadLegend
>
40.
</
ScrollView
>
41.
</
Grid
>
42.
</
ListView.Header
>