Click here to Skip to main content
15,906,341 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I would like to give different colors to series in chart using c#.net Programmatically can anyone help
Posted

This should Random Color Generator[^] help you get going.
 
Share this answer
 
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:
C#
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));
}


OR use the following:
How to generate random color names in C#[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900