问题
Is there a way to create my own charting palette in which I can specify my own colors?
The ones that are available from
chart.Palette = System.Web.UI.DataVisualization.Charting.ChartColorPalette. //palette
do not really fit in with our design, so creating my own would be nice if this is possible thanks!
回答1:
You can define your own palette using chart's PaletteCustomColors collection.
chart.PaletteCustomColors.Add(Color.Red);
chart.PaletteCustomColors.Add(Color.Blue);
Also if you need to control a color of each datapoint use the datapoint's color:
chart.Series[0].Points[0].Color = Color.Red;
Note: Bind chart to data before setting the datapoint colors.
来源:https://stackoverflow.com/questions/3737652/creating-a-custom-palette-in-microsoft-charting