This question is locked. New answers and comments are not allowed.
Hi,
I have the following code to add data to my pie chart in code, but I don't seem to figure out how to set the label for each slice. I looked at the docs but did not really see how to translate my Dictionary.
The Dictionary contains <label, value>. So I just want to use this in the pie chart for data binding.
Dictionary<string, int> data = DBHelper.GetTriggerStats();
int[] result = new int[data.Count()];
int i = 0;
foreach (KeyValuePair<string, int> pair in data)
{
result[i] = pair.Value;
i++;
}
PieSeries series = this.TriggerPieChart.Series[0] as PieSeries;
series.ItemsSource = result;
How can I set the label for the pie chart that is in my KeyValuePair as the Key.
Thanks,
S.
I have the following code to add data to my pie chart in code, but I don't seem to figure out how to set the label for each slice. I looked at the docs but did not really see how to translate my Dictionary.
The Dictionary contains <label, value>. So I just want to use this in the pie chart for data binding.
Dictionary<string, int> data = DBHelper.GetTriggerStats();
int[] result = new int[data.Count()];
int i = 0;
foreach (KeyValuePair<string, int> pair in data)
{
result[i] = pair.Value;
i++;
}
PieSeries series = this.TriggerPieChart.Series[0] as PieSeries;
series.ItemsSource = result;
How can I set the label for the pie chart that is in my KeyValuePair as the Key.
Thanks,
S.