Custom Label Colors

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Andrew S
Newbie
Newbie
Posts: 42
Joined: Wed Jul 28, 2004 4:00 am

Custom Label Colors

Post by Andrew S » Thu Sep 22, 2005 9:24 pm

I think I must be missing something very simple here. I can't seem to change the colour of a custom label in my chart. I've checked the TeeChart Pro demo program, and I still can't figure it out.

For example: I create a new application, add a TChart and create a new THorizontalBarSeries. I put the following in the main form's OnShow event:

Code: Select all

procedure TForm1.FormShow(Sender: TObject);
var
  i : integer;
begin
  Series1.AddArray([200,0,123,300,260,-100,650,400]);
  Chart1.LeftAxis.Items.Clear;
  for i := 0 to 7 do
  begin
    chart1.Leftaxis.Items.Add(i, 'test' + intToStr(i));
    chart1.Leftaxis.Items[i].color := clRed;
    writeln(chart1.Leftaxis.Items[i].Text);
  end;
  chart1.Repaint;
end;
...all my labels are still black. Just to verify that it was displaying my custom lables, and not the automatic ones, I changed the add line to read

Code: Select all

if i mod 2 = 0 then chart1.leftaxis.items.add(i, 'test' + intoToStr(i));
This results in every other line having a label, so obviously my custom labels are being displayed. Also, opening up a console window and writing the label text as above displays the proper text, so I'm indexing the labels properly when I try to set their colour. Why are they all black?

Just FYI, I'm using TeeChart Pro 7.01 for Delphi 5.0

Thanks,

Andrew

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

Post by Narcís » Fri Sep 23, 2005 9:52 am

Hi Andrew,

It works fine here using v7.05, latest version available at our Customer Download Area, and the code below. The key for having a coloured background is turning off transparency.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i : integer;
begin
  Series1.AddArray([200,0,123,300,260,-100,650,400]);

  With Chart1.Axes.Left.Items do
  begin
    Clear;

    for i := 0 to 7 do
      with Add(i*30, 'test' + intToStr(i)) do
      begin
        Transparent:=False;
        Transparency:=50;
        Color := clRed;
        Font.Color:=clBlue;
      end;
  end;
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

Andrew S
Newbie
Newbie
Posts: 42
Joined: Wed Jul 28, 2004 4:00 am

Post by Andrew S » Fri Sep 23, 2005 4:11 pm

I guess I'll try upgrading the 7.05!

I've noticed that the examples all use chart.Axes.Left as opposed to chart.LeftAxis - is there a difference?

Andrew S
Newbie
Newbie
Posts: 42
Joined: Wed Jul 28, 2004 4:00 am

Post by Andrew S » Fri Sep 23, 2005 5:00 pm

The latest version I can find in the customer download section is 7.04. I found a 7.05 for Builder, but obviously that won't work with Delphi 5. Is 7.04 the latest version for Dephi 5 Professional?

Andrew S
Newbie
Newbie
Posts: 42
Joined: Wed Jul 28, 2004 4:00 am

Post by Andrew S » Fri Sep 23, 2005 6:00 pm

I installed TeeChart 7.04 for Delphi 5 and now it works.

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

Post by Narcís » Mon Sep 26, 2005 8:08 am

Hi Andrew,

Sorry, v7.05 is only available for BCB as it only was an update to overcome some installing problems with BCB.
I've noticed that the examples all use chart.Axes.Left as opposed to chart.LeftAxis - is there a difference?
There's no difference but you'd better use the one used in the examples as LeftAxis is deprecated.
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

Post Reply