Colors with column charts
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
SIGN IN To post a reply.
3 Replies
DJ
Davis Jebaraj
Syncfusion Team
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
RB
Ronda Bergman (see 360683)
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
Thanks Ronda
VV
Venkata Vijayaraj B
Syncfusion Team
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.
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.
SIGN IN To post a reply.
- 3 Replies
- 4 Participants
-
JP Jarrod Peace
- Jan 3, 2005 05:28 PM UTC
- Aug 25, 2009 11:04 AM UTC