Page 1 of 1

Candle Series and colours

Posted: Tue Oct 28, 2008 4:52 pm
by 10549714
Hi

I have a chart with three different candle series where I'm using CandleStyle := csLine. (The only reason for using the candle series is to be able to do R.S.I.). All three series come out in the same colour (black) though. I've set the SeriesColor to clTeeColor and also UpCloseColor and DownCloseColor to SeriesColor but it still comes out in black...

I think it might be displaying using the border colour of the candle (but I'm using csLine). Any pointers on how to make sure the series gets different colours?

BRgds,
Marius

Posted: Thu Oct 30, 2008 9:58 am
by narcis
Hi Marius,

Which TeeChart version are you using? It seems to works fine for me here using v8.04 VCL which has been published recently. If the problem persists could you please send us a simple example project we can run "as-is" to reproduce the problem here?

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Thu Oct 30, 2008 10:10 am
by 10549714
Thanks Narcís

I'm using 8.04 and doing it all in code at runtime.
I've just tried doing the same in the designer and it works just fine, so I guess we'll need to look at my code.

I create the series like this:

Code: Select all

    Custom1 := TCandleSeries.Create(Self);
    Custom1.CandleStyle    := csLine;
    Custom1.SeriesColor    := clTeeColor;
    Custom1.UpCloseColor   := Custom1.SeriesColor;
    Custom1.DownCloseColor := Custom1.SeriesColor;
    Custom1.Title := 'Some text';
    Custom1.HorizAxis := aBottomAxis;
    Custom1.VertAxis  := aLeftAxis;
    Custom1.Pen.Width := 2;
    Custom1.XValues.DateTime := true;
I do this up to three times and all the series print in the same colour...

Marius

Posted: Thu Oct 30, 2008 10:22 am
by narcis
Hi Marius,

Thanks for the information.

Using code below works fine for me here.

Code: Select all

uses Series, CandleCh;

procedure TForm1.FormCreate(Sender: TObject);
var
  Custom1 : TCandleSeries;
begin
    Custom1 := TCandleSeries.Create(Self);
    Custom1.CandleStyle    := csLine;
    //Custom1.SeriesColor    := clTeeColor;
    //Custom1.UpCloseColor   := Custom1.SeriesColor;
    //Custom1.DownCloseColor := Custom1.SeriesColor;
    Custom1.Title := 'Some text';
    Custom1.HorizAxis := aBottomAxis;
    Custom1.VertAxis  := aLeftAxis;
    Custom1.Pen.Width := 2;
    Custom1.XValues.DateTime := true;
    Custom1.FillSampleValues();

    Chart1.AddSeries(Custom1);
end;

Posted: Thu Oct 30, 2008 10:40 am
by 10549714
Narcis

I've changed my code to look like this. The result is three lines where the Ups are red and the Downs are white. Also, the colours I get in the legend is different from the series...

To reproduce, I have dropped an empty chart on a form and doing the below in FormCreate

I need three lines with different colours and with the same colour regardless of whether the value goes up or down.

Code: Select all

var
  Custom1 : TCandleSeries;
  Custom2 : TCandleSeries;
  Custom3 : TCandleSeries;
begin
  Custom1 := TCandleSeries.Create(Self);
  Custom1.CandleStyle    := csLine;
  Custom1.Title := 'Some text';
  Custom1.HorizAxis := aBottomAxis;
  Custom1.VertAxis  := aLeftAxis;
  Custom1.Pen.Width := 2;
  Custom1.XValues.DateTime := true;
  Custom1.FillSampleValues(100);

  Chart1.AddSeries(Custom1);

  Custom2 := TCandleSeries.Create(Self);
  Custom2.CandleStyle    := csLine;
  Custom2.Title := 'Some text';
  Custom2.HorizAxis := aBottomAxis;
  Custom2.VertAxis  := aLeftAxis;
  Custom2.Pen.Width := 2;
  Custom2.XValues.DateTime := true;
  Custom2.FillSampleValues(100);

  Chart1.AddSeries(Custom2);

  Custom3 := TCandleSeries.Create(Self);
  Custom3.CandleStyle    := csLine;
  Custom3.Title := 'Some text';
  Custom3.HorizAxis := aBottomAxis;
  Custom3.VertAxis  := aLeftAxis;
  Custom3.Pen.Width := 2;
  Custom3.XValues.DateTime := true;
  Custom3.FillSampleValues(100);

  Chart1.AddSeries(Custom3);

end;
Thanks for looking into this

BRgds
Marius

Posted: Thu Oct 30, 2008 11:31 am
by narcis
Hi Marius,

Ok, in that case you can do this:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  Custom1 : TCandleSeries;
  Custom2 : TCandleSeries;
  Custom3 : TCandleSeries;
begin
  Custom1 := TCandleSeries.Create(Self);
  Custom1.CandleStyle    := csLine;
  Custom1.Title := 'Some text';
  Custom1.HorizAxis := aBottomAxis;
  Custom1.VertAxis  := aLeftAxis;
  Custom1.Pen.Width := 2;
  Custom1.XValues.DateTime := true;
  Custom1.FillSampleValues(100);
  Custom1.UpCloseColor:=clRed;
  Custom1.DownCloseColor:=Custom1.UpCloseColor;

  Chart1.AddSeries(Custom1);

  Custom2 := TCandleSeries.Create(Self);
  Custom2.CandleStyle    := csLine;
  Custom2.Title := 'Some text';
  Custom2.HorizAxis := aBottomAxis;
  Custom2.VertAxis  := aLeftAxis;
  Custom2.Pen.Width := 2;
  Custom2.XValues.DateTime := true;
  Custom2.FillSampleValues(100);
  Custom2.UpCloseColor:=clBlue;
  Custom2.DownCloseColor:=Custom2.UpCloseColor;

  Chart1.AddSeries(Custom2);

  Custom3 := TCandleSeries.Create(Self);
  Custom3.CandleStyle    := csLine;
  Custom3.Title := 'Some text';
  Custom3.HorizAxis := aBottomAxis;
  Custom3.VertAxis  := aLeftAxis;
  Custom3.Pen.Width := 2;
  Custom3.XValues.DateTime := true;
  Custom3.FillSampleValues(100);
  Custom3.UpCloseColor:=clYellow;
  Custom3.DownCloseColor:=Custom3.UpCloseColor;

  Chart1.AddSeries(Custom3);
end;

Posted: Thu Oct 30, 2008 11:38 am
by 10549714
Narcís

This works fine except now I have to assign the colours manually rather than relying on TChart to do it.

Also, the legend display completely different colours again

Marius

Posted: Mon Nov 03, 2008 12:15 pm
by Pep
Hello Marius,

yes, to have both correctly displayed you have to assign the UpCloseColor and Series.Color :

Code: Select all

  Custom3.Color := clyellow;
  Custom3.UpCloseColor:=clYellow;