Hi,
I've a chart with white background and if dynamically generated series. How could I make sure that the colours assigned to these series are not white? Or to have the series only using a range of colours that would go well with a white background.
Thanks.
Dynamically generating series color
Hi Dave
You can do an array with your wish colors, and then when you generate a new serie also put the wish color, you can do something similar as below code:
You can do an array with your wish colors, and then when you generate a new serie also put the wish color, you can do something similar as below code:
Code: Select all
Color[] cl;
int cl_index;
private void Form1_Load(object sender, EventArgs e)
{
cl = new Color[]
{
Color.Red,Color.Salmon,Color.Green,Color.Blue
};
cl_index = 0;
}
private void button1_Click(object sender, EventArgs e)
{
Line line = new Line(tChart1.Chart);
line.Color = cl[(cl_index++)%cl.Length];
line.FillSampleValues();
}