I have a Pie Chart whose datasource is getting bound dynamically based on user input. I do not like the default colors -- they are not distinct enough -- how can I set the colors of the wedges directly in the code?
Thanks for the solution - worked like a charm.
Here is how I solved it:
PieChart.DataBind += PieChart_DataBind; ... private void PieChart_DataBind(object sender, Infragistics.Windows.Chart.DataBindEventArgs e) { if (PieChart.Series.Count > 0) { var count = PieChart.Series[0].DataPoints.Count; for (int i = 0; i < count; i++) { var color = Infragistics.ColorUtil .FromAHSV(1d, i.ToDouble() * 360d / count.ToDouble(), 1d, .72); PieChart.Series[0].DataPoints[i].Fill = new SolidColorBrush(colors[i]); } } }
I too have this problem.
You can set the colors in code for the pie chart slices via this mechanism:
xamChart1.StartPaletteBrush = Brushes.Red;
xamChart1.EndPaletteBrush = Brushes.Green;