We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

custom brushes

Thread ID:

Created:

Updated:

Platform:

Replies:

108927 May 21,2013 04:08 PM UTC Jul 8,2013 11:42 PM UTC WinRT 6
loading
Tags: Chart
Lars Powers
Asked On May 21, 2013 04:08 PM UTC

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}" />


Sheik Syed Abthaheer M [Syncfusion]
Replied On May 23, 2013 11:29 AM UTC

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

Rob Skoon
Replied On July 1, 2013 07:54 PM UTC

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?



Sheik Syed Abthaheer M [Syncfusion]
Replied On July 2, 2013 11:13 AM UTC

Hi Rob,

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,
M. Sheik


WinRTPieChatColorModelDemo_c85cb69c.zip

Rob Skoon
Replied On July 2, 2013 06:13 PM UTC

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?


Sheik Syed Abthaheer M [Syncfusion]
Replied On July 4, 2013 08:46 AM UTC

Hi Rob,

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

Rob Skoon
Replied On July 8, 2013 11:42 PM UTC

Thanks


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;