Setting Line Colour In TChart

0 votes
asked Mar 18, 2010 by chendriksen

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:


1 Answer

0 votes
answered Mar 18, 2010 by bruce-mcgee

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

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


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;
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter