I am trying to produce a simple pie chart with numeric values and labels for each value. I am using an MVVM pattern and am trying to avoid code in the code behind. I have a simple object being bound as the series data source:
C#public class ViewModel
{
public ObservableCollection<DataPoint> DataPoints
}
public class DataPoint
{
public string Name { get; set; }
public decimal Value { get; set; }
public override string ToString()
{
return Name;
}
}
When I produce the chart, the legend and datapoints on the chart itself do not show the data point Name. I am using a binding expression like the below:
XAML<dxc:PieSeries2D ArgumentDataMember="Name"
ValueDataMember="Value"
LabelsVisibility="True"
HoleRadiusPercent="0"
DataSource="{Binding Path=PointsCollection, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}">
</dxc:PieSeries2D>
I have attached a sample project. How would I use a DataTemplate for both the Legend and the series point labels to be able to render the values on the model that I am using as the series datasource?
Also, how to I specify that I don't want percentages, I want the actual numbers?