Custom labels and axis labels

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
FM
Newbie
Newbie
Posts: 7
Joined: Mon Apr 19, 2004 4:00 am

Custom labels and axis labels

Post by FM » Thu Jun 30, 2005 8:49 am

I have a vertical axis with labels.
Now, I need to add a custom label, showing the last value of the series.
If I add the new custom label with this code

lastValue := mySeries.YValues[k];

with mySeries.GetVertAxis.Items.Add(lastValue) do
begin
Transparent := False;
Transparency := 50;
Color := clBlue;
end;

all previous labels become invisible.
How can I add a custom label without hiding all other labels?

Thanks
FM

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 Jun 30, 2005 10:51 am

Hi FM,

To achieve what you request you should use Canvas.TextOut method in the AfterDraw event:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  Chart1.Canvas.Font.Color:=clRed;
  Chart1.Canvas.TextOut(Chart1.Axes.Left.PosAxis-25,
                        Series1.CalcYPos(Series1.LastValueIndex),
                        FloatToStr(Series1.YValue[Series1.LastValueIndex]));
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

FM
Newbie
Newbie
Posts: 7
Joined: Mon Apr 19, 2004 4:00 am

Post by FM » Fri Jul 01, 2005 7:59 am

Great! Exactly what I need.

Many thanks, Narcìs.

Best Regards

FM

Post Reply