参考下面这两篇文章试试: How to change the color of individual columns in a chart control?
How to add different color of column in chart control in asp.net
foreach (ProjectStatistic PR in repository.GetProjectByRAG()) { int index = ProjectsByProjectTypePieChart.Series["series"].Points.AddXY(PR.Name, PR.Value); if (PR.Name == "Green") { ProjectsByProjectTypePieChart.Series["series"].Points[index].Color = System.Drawing.Color.Green; } if (PR.Name == "Amber") { ProjectsByProjectTypePieChart.Series["series"].Points[index].Color = System.Drawing.Color.Yellow; } if (PR.Name == "Red") { ProjectsByProjectTypePieChart.Series["series"].Points[index].Color = System.Drawing.Color.Red; } }
亲,上面代码中用的图表是MSChart吗,代码有点看不懂
http://www.cnblogs.com/skykang/archive/2011/11/22/2258872.html ,看下最下面,希望对你有帮助
Color[] colorSet = new Color[4] { Color.Red, Color.Blue, Color.Green, Color.Purple }; chart.PaletteCustomColors = colorSet; chart.Palette = ChartColorPalette.None;