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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Colors with column charts

Thread ID:

Created:

Updated:

Platform:

Replies:

23032 Jan 3,2005 05:28 PM UTC Aug 25,2009 11:04 AM UTC WinForms 3
loading
Tags: Chart
Jarrod Peace
Asked On January 3, 2005 05:28 PM UTC

Hello, I was wondering if there was a way to specify different colors for each data point in a column series, much like the CustomColors array method with a pie series. I would prefer not to create a separate series for each point. Thank you for your help. - Jarrod

Davis Jebaraj [Syncfusion]
Replied On January 3, 2005 08:28 PM UTC

Hi Jarrod, The color of each of the columns (points) in a Column Chart can be changed by handling the PrepareStyle event of the series. Please refer to the sample linked to below: F23032ChartPointsColor_8544.zip The relevant portion of the code in C# is also posted below: series.PrepareStyle += new ChartPrepareStyleInfoHandler(this.ChartControlSeries_PrepareStyle); protected void ChartControlSeries_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args) { ChartSeries series = sender as ChartSeries; int r, g, b; switch(args.Index) { case 0: r = 222;b=245;g=123; break; case 1: r = 122;b=145;g=123; break; case 2: r = 22;b=45;g=123; break; case 3: r = 202;b=225;g=123; break; case 4: r = 22;b=125;g=123; break; case 5: r = 200;b=45;g=123; break; case 6: r = 2;b=25;g=23; break; case 7: r = 222;b=24;g=123; break; case 8: r = 222;b=245;g=3; break; case 9: r = 222;b=245;g=123; break; case 10: r = 222;b=5;g=123; break; case 11: r = 22;b=25;g=123; break; default: r = 222;b=245;g=123; break; } if(series != null) { args.Style.Interior = new BrushInfo(GradientStyle.None,Color.Black,Color.FromArgb(r,g,b ) ); args.Handled = true; } Thanks, Davis

Ronda Bergman (see 360683)
Replied On August 21, 2009 09:10 PM UTC

I would like to be able to view this sample code but am getting a file not found error.

Thanks Ronda

Venkata Vijayaraj B [Syncfusion]
Replied On August 25, 2009 11:04 AM UTC

Hi Ronda,

Thanks for your interest in Syncfusion products.

Since, We were updated our server recently, some locations are changed. We are checking with this location and will

send you once we get the updated link.

I have created a similar sample and attached in the below link. I have mentioned another code also in the sample to

customize the color of individual points.


Sample Link:
http://files.syncfusion.com/support/Chart.Windows/v7.3.0.20/F23032/main.htm

Please let me know if this helps.

Regards,
Venkat.

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.

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

;