views:

201

answers:

1

How can I change the colour of a line in a TChart in Delphi at run time? For example, how would I change the colour of:

Chart1.Series[a].

+3  A: 

You almost have it. Just set the colour in the series you're interested in.

  Chart1.Series[0].Color := clBlue;

Update:

Colors are just hex constants in Blue, Green, Red order. The predefined list is in Graphics.pas, but you can use any hex value you like. This line also sets the color of the first series to blue:

  Chart1.Series[0].Color := $FF0000;

If you have more than one series defined, you can do something like this:

  Chart1.Series[0].Color := clGreen;
  Chart1.Series[1].Color := clYellow;
Bruce McGee
Thanks! If i want to set a shade of colour though, such as a light green for one line and a dark green for another, would this be possible? Is there anywhere i can find a list of the available colours?
Chris55
There are lots of color constants defined in graphics.pas.
Alan Clark