且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用c#.net为图表中的特定系列赋予颜色

更新时间:2023-01-24 22:59:31

这应该 ^ ]助您一臂之力.
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#[^]