Chart for WinRT > Chart Types > Pie Charts > Adding Labels to Pie Charts |
To add multiple values to a Pie chart label, you can create a label template like the following:
XAML Markup |
Copy Code
|
---|---|
<Chart:C1Chart Name="c1Chart1" ChartType="Pie"> <Chart:C1Chart.Resources> <DataTemplate x:Key="lbl"> <StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Name}" /> <TextBlock Text="=" /> <TextBlock Text="{Binding Path=Value}" /> </StackPanel> <TextBlock Text="{Binding Path=PercentageSeries,Converter={x:Static c1chart:Converters.Format}, ConverterParameter=#.#%}"/> </StackPanel> </DataTemplate> </Chart:C1Chart.Resources> <Chart:C1Chart.Data> <Chart:ChartData> <Chart:DataSeries Values="20 22 19 24 25" PointLabelTemplate="{StaticResource lbl}" /> </Chart:ChartData> </Chart:C1Chart.Data> <Chart:C1ChartLegend DockPanel.Dock="Right" /> </Chart:C1Chart> |