I have to assign the individual color to Column bar chart i tried the below it is working
but i want loop through each chart series item and assign them a color from an array. Is it possible with MS Chart control iam using the Column Bar chart for displaying the data.
Any hint or Idea is appericated
Regards
life is name of learning!
Mark as an answer if it helps
You have to set LabelColor for changing the bar color.
//colors array... Color[] colors = newColor[] { Color.Red, Color.Green, Color.Wheat, Color.Gray }; foreach (Series series in Chart1.Series) { foreach (DataPoint point in series.Points) { //Set color for the bar point.LabelBackColor = colors[series.Points.IndexOf(point)]; } }
Make sure that your color array has same number of items as the Series DataPoints collection.
Contributor
2633 Points
1773 Posts
How Do I Assign Individual Colors to Bars in MS Chart Control
Feb 12, 2011 01:16 AM|Rameezwaheed|LINK
Hi all,
I have to assign the individual color to Column bar chart i tried the below it is working
but i want loop through each chart series item and assign them a color from an array. Is it possible with MS Chart control iam using the Column Bar chart for displaying the data.
Any hint or Idea is appericated
Regards
Mark as an answer if it helps
All-Star
37505 Points
8109 Posts
Re: How Do I Assign Individual Colors to Bars in MS Chart Control
Feb 12, 2011 02:21 PM|sansan|LINK
You have to set LabelColor for changing the bar color.
Make sure that your color array has same number of items as the Series DataPoints collection.