如何使用c#.net为图表中的特定系列赋予颜色 [英] how to give color to particular series in chart using c#.net
本文介绍了如何使用c#.net为图表中的特定系列赋予颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用c#.net为图表中的系列赋予不同的颜色,任何人都可以以编程方式提供帮助
I would like to give different colors to series in chart using c#.net Programmatically can anyone help
推荐答案
这应该 ^ ]助您一臂之力.
This should Random Color Generator[^] help you get going.
为Series公开了一个属性"Color
".
看这里:
MSDN:DataPointCustomProperties.Color属性 [ ^ ]
MSDN:系列类-属性部分 [ ^ ]
生成随机颜色并分配给该系列.
在此处生成随机颜色:
试试类似的东西:
There is a property ''Color
'' exposed for Series.
Look here:
MSDN: DataPointCustomProperties.Color Property [^]
MSDN: Series Class- Properties section[^]
Generate random colors and assign to the series.
Look here for generating random colors:
Try something like:
Random RandGen = new Random();
private Color GetRandomColor()
{
// define range of RGB between which you want to create
return Color.FromArgb(RandGen.Next(40, 210), RandGen.Next(60, 245), RandGen.Next(50, 220));
}
或使用以下命令:
如何在C#中生成随机颜色名称 [ ^ ]
OR use the following:
How to generate random color names in C#[^]
这篇关于如何使用c#.net为图表中的特定系列赋予颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文