Candle Series and colours

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Marius
Newbie
Newbie
Posts: 28
Joined: Tue Jul 29, 2008 12:00 am

Candle Series and colours

Post by Marius » Tue Oct 28, 2008 4:52 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Oct 30, 2008 9:58 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marius
Newbie
Newbie
Posts: 28
Joined: Tue Jul 29, 2008 12:00 am

Post by Marius » Thu Oct 30, 2008 10:10 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Oct 30, 2008 10:22 am

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;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marius
Newbie
Newbie
Posts: 28
Joined: Tue Jul 29, 2008 12:00 am

Post by Marius » Thu Oct 30, 2008 10:40 am

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Oct 30, 2008 11:31 am

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;
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marius
Newbie
Newbie
Posts: 28
Joined: Tue Jul 29, 2008 12:00 am

Post by Marius » Thu Oct 30, 2008 11:38 am

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

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Nov 03, 2008 12:15 pm

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;

Post Reply