How can I bind the CustomBrushes of a pie chart to a collection of brushes that are populated programmatically?
In other words, in the code behind, I want to be able to dynamically construct a collection of brushes, and then have those bound to the chart's color model similar to this:
<chart:ChartColorModel CustomBrushes="{Binding MyBrushes}" />
Hi Powers,
Thanks for using Syncfusion products.
We have analyzed your query and you can able to bind the collection of custom brushes in Chart series color model. We have prepared the sample based on your requirement. Please download it from the given below location.
Please let us know if you have any queries.
Regards,
M. Sheik
I'm unable to download this sample due to the website being under maintenance, but am seeing a similar failure. I am trying to do the following from code behind though to repro the problem:
ChartColorModel palette = new ChartColorModel();
palette.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)));
palette.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 255, 0)));
palette.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 0, 255)));
palette.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 255, 0, 255)));
palette.CustomBrushes.Add(new SolidColorBrush(Color.FromArgb(255, 0, 255, 255)));
sfChartPieType.Palette = ChartColorPalette.Custom;
sfChartPieType.ColorModel = palette;
Am I missing / thinking about how this works wrong?
OK... that works. You were setting the custom palette on the series, not the chart itself.
So that works and solves my problem for a PieChart that only has one series, where are you supposed to set it on a LineChart that has multiple series?
Thanks