custom brushes
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
WinRTPieColorModelDemo_6567a8f4.zip
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?
Thanks for using Syncfusion products.
We have analyzed your query and we are unable to reproduce any issue at our end. Also we would like to inform you that the line of given code is the right way for applying CustomBrush to the ChartSeries. We have prepared the sample by using the same line of code based on your update. Please download the sample from the given below location.
Please let us know if you have any queries.
Regards,
WinRTPieChatColorModelDemo_c85cb69c.zip
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 for your update.
We request to set Custom palette on Chart in order to apply Custom brush in Multiple Series as shown in the given below code snippet.
Code Snippet[C#]:
_chart.Palette = ChartColorPalette.Custom;
_chart.ColorModel = palette;
We have prepared the sample based on your requirement. Please download the sample in the given below location.
Sample :
Note: If you want to apply Custom Brushes for different Segment of Series then we need to set Custom Palette on ChartSeries(like Accumulation Chart types).
Otherwise if you want to apply Custom Brushes for different Series of a Chart then we need to set Custom Palette on Chart. In case of accumulation series like Pie Chart, Palette can be applied for different segments only.
Please let us know if you have any queries.
Regards,
M. Sheik
LineChartColorModelDemo_9a63f34d.zip
Thanks
- 6 Replies
- 3 Participants
-
LP Lars Powers
- May 21, 2013 04:08 PM UTC
- Jul 8, 2013 11:42 PM UTC