The key of the misunderstanding is the concepts of series and points. In ChartFX we can handle 1 or more series, each of these series will be composed by one or more points. In a line chart, each series is represented by a different line, in a pie chart each series is represented as a pie with each point being a slice.
There is also a behavior difference between bar/line/area charts and pie/doughnut/pyramid charts. In the former we default to show the series legend while the latter will display the points legend.
So to customize the items displayed in a legendbox for a pie chart you have the following options
1) If you just want to replace the default string with another string
Use the AxisX Labels, using your XAML as a sample you would add the following
<
ChartFX:Chart.AxisX>
<ChartFX:Axis>
<ChartFX:Axis.Labels>
<ChartFX:AxisLabelAttributes BindingPath="@Label"/>
</ChartFX:Axis.Labels>
</ChartFX:Axis>
</ChartFX:Chart.AxisX>
2) If you want to keep the marker but want to display something other than a string
Use the SeriesAttributes ContentTemplate properties. Note that in a single chart you can use the AllSeries.ContentTemplate property. NOTE: There is a bug in current builds that will interfere with series templates in a pie chart. This approach will work in builds marked version 3043 or later.
<
ChartPoints xmlns="">
<Point Value="5" Label="Consumer" Image="pack://siteoforigin:,,,/Img/Consumer.png" />
<Point Value="7" Label="Energy" Image="pack://siteoforigin:,,,/Img/Energy.png" />
<Point Value="4" Label="Technology" Image="pack://siteoforigin:,,,/Img/Technology.png" />
<Point Value="3" Label="Healthcare" Image="pack://siteoforigin:,,,/Img/Healthcare.png" />
<Point Value="7" Label="Financial" Image="pack://siteoforigin:,,,/Img/Financial.png" />
</ChartPoints>
Note that these images will be retrieved from an Img subdirectory of your app's folder. To assign the template you would add this to your XAML
<
ChartFX:Chart.AllSeries>
<ChartFX:AllSeriesAttributes>
<ChartFX:AllSeriesAttributes.ContentTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding XPath=@Image}" Width="24" Height="24"/>
<TextBlock Text="{Binding XPath=@Label}" Margin="2,0" VerticalAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ChartFX:AllSeriesAttributes.ContentTemplate>
</ChartFX:AllSeriesAttributes>
</ChartFX:Chart.AllSeries>
Also note that your template will be used against the objects you pass to the chart so if you will be passing CLR objects (e.g. LinQ) you will use Bindings using Path instead of XPath
3) If you want to completely control how the legend item looks (ADVANCED)
Use the LegendItemAttributes.Template property, remember that in a pie chart we show the points legend using labels stored in the X axis so your code would be
chart1.LegendBox.ItemAttributes[chart1.AxisX].Template = (DataTemplate) FindResource("RichContentLegend");
The template will be bound to a logical object that has several properties, e.g. Fill, Stroke, etc. These are the visual properties for this slice so that you can allow the user a way to identify the item being labeled. It also exposes a DataItem property that returns the CLR object associated with each point. When binding to XAML we have found some issues if you try to use both XPath and Path in a Binding so we also expose a DataItemClr property that will synthesize an object based on your XML nodes.
<DataTemplate x:Key="MyLegendTemplate">
<StackPanel Orientation="Horizontal" Margin="0,3">
<Ellipse Fill="{Binding Path=Fill}" Width="24" Height="24" />
<Image Source="{Binding Path=DataItemClr.@Image}" Width="24" Height="24"/>
<TextBlock Text="{Binding Path=DataItemClr.@Label}" Margin="2,0" VerticalAlignment="Center"/>
</StackPanel>
</DataTemplate>
Regards,
JuanC