DrawAxisLabel - Formatting

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Heinz
Newbie
Newbie
Posts: 18
Joined: Wed Jan 21, 2009 12:00 am

DrawAxisLabel - Formatting

Post by Heinz » Tue Oct 19, 2010 3:25 pm

Hi,

I draw additional labels to the bottom axis using BottomAxis.DrawAxisLabel.

The attached picture shows the labels 200 and 500 added.
drawaxislabel.JPG
drawaxislabel.JPG (34.84 KiB) Viewed 3844 times
Now I want the custom labels to get the same format as the default labels from the bottom axis.
How can I set the properties for the custom labels (f.e. font style, font size, ...)?

Best regards

Heinz

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: DrawAxisLabel - Formatting

Post by Yeray » Tue Oct 19, 2010 4:14 pm

Hi Heinz,

I'm afraid you have to assign the properties you want to the Canvas before calling the DrawAxisLabel method. Something like this:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var val: Double;
begin
  val:=250;

  Chart1.Canvas.Font.Style:=Chart1.Axes.Bottom.LabelsFont.Style;
  Chart1.Canvas.Font.Color:=Chart1.Axes.Bottom.LabelsFont.Color;
  Chart1.Canvas.Font.Size:=Chart1.Axes.Bottom.LabelsFont.Size;
  Chart1.Canvas.Font.Name:=Chart1.Axes.Bottom.LabelsFont.Name;

  with Chart1.Axes.Bottom do DrawAxisLabel(CalcXPosValue(val), PosAxis+TickLength+2, 0, FloatToStr(val));
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Heinz
Newbie
Newbie
Posts: 18
Joined: Wed Jan 21, 2009 12:00 am

Re: DrawAxisLabel - Formatting

Post by Heinz » Wed Oct 20, 2010 9:42 am

Hello Yeray,

that was the missing link.

Many thanks and best regards

Heinz

Post Reply