ComponentOne Chart for WPF and Silverlight
Chart for WPF and Silverlight / Chart Types / Pie Charts / Adding Labels to Pie Charts
In This Topic
    Adding Labels to Pie Charts
    In This Topic

    To add multiple values to a Pie chart label you can create a label template like the following:

    XAML
    Copy Code
    <c1chart:C1Chart Name="c1Chart1" ChartType="Pie">
          <c1chart: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>
          </c1chart:C1Chart.Resources>
          <c1chart:C1Chart.Data>
            <c1chart:ChartData>
              <c1chart:ChartData.ItemNames>P1 P2 P3 P4 P5</c1chart:ChartData.ItemNames>
              <c1chart:DataSeries Values="20 22 19 24 25" PointLabelTemplate="{StaticResource lbl}" />
            </c1chart:ChartData>
          </c1chart:C1Chart.Data>
          <c1chart:C1ChartLegend DockPanel.Dock="Right" />
        </c1chart:C1Chart>
    
    See Also