Creating a custom palette in microsoft charting

不打扰是莪最后的温柔 提交于 2019-12-12 01:58:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!