Board index » delphi » TChart TLineSeries won't change color?

TChart TLineSeries won't change color?

I can't seem to make line series change color on my chart. I use a loop to add multiple series, which are all required to be the same color.

The code inside the loop is:

aSeries := TLineSeries.Crreate (Chart1);
.. add some data to the series...
aSeries.LinePen.Color := clBlue;
Chart1.AddSeries (aSeries);

The first few lines come out all colors and the rest come out red. What am I doing wrong?

 

Re:TChart TLineSeries won't change color?


Some hints!

I usually do not monitor news groups, so write to my e-mail if I need to follow this up!

Set ColorEachPoint on your series to True.
  Series1.ColorEachPoint :=True; // you can also do this from within the TChart editor

If you do not apply info about the color, the TChart will take the colors from this constant:
  ColPal: Array[1..MaxDefaultColors] of TColor (clRed, clGreen, cl.....);
  Where MaxDefaultColors is 16.

This means that if you have more than 16 points, then the colors would overlap.
I usually set the color by calculation or create a larger set of color constants and uses them.

  Series1.Add(AFloatValue[C], ATextValue[C]); // using TChart's color set
  Series1.Add(AFloatValue[C], ATextValue[C], ColPal[C]); // using TChart's color set but here we deside witch color from the set is used
  Series1.Add(AFloatValue[C], ATextValue[C], MyColPal[C]); // using my own set of colors
  Series1.Add(AFloatValue[C], ATextValue[C], C); // using calculated colors

Regards
        Olrik Larsen
        Ol...@MercuryGroup.dk

On 10 Oct 2001 23:45:57 -0700, "Stuart Anstee" <stuart.ans...@dsto.defence.gov.au> wrote:

Quote

>I can't seem to make line series change color on my chart. I use a loop to add multiple series, which are all required to be the same color.

>The code inside the loop is:

>aSeries := TLineSeries.Crreate (Chart1);
>.. add some data to the series...
>aSeries.LinePen.Color := clBlue;
>Chart1.AddSeries (aSeries);

>The first few lines come out all colors and the rest come out red. What am I doing wrong?

Other Threads