Put space between LeftAxisLabel and Ticks

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
MVBobj
Newbie
Newbie
Posts: 34
Joined: Fri Jul 17, 2015 12:00 am
Contact:

Put space between LeftAxisLabel and Ticks

Post by MVBobj » Tue Aug 04, 2015 2:59 pm

Ok - on my chart, the labels for the left axis are right up against the ticks. I would like to put a space or two in between - without losing right justified on the labels.

How do I do that?

Thanks.

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

Re: Put space between LeftAxisLabel and Ticks

Post by Narcís » Tue Aug 04, 2015 3:00 pm

Hello,

The only options I can think of are:

1. Increasing ticks length, for example:

Code: Select all

  Chart1.Axes.Left.TickLength:=10;
2. Implementing the OnGetAxisLabel doing something like the code snippet below, where some white spaces are being added with an additional character preventing them to be trimmed.

Code: Select all

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  if Sender = Chart1.Axes.Left then
    LabelText:=LabelText+'    ·';
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

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

Re: Put space between LeftAxisLabel and Ticks

Post by Narcís » Wed Aug 05, 2015 7:18 am

For completeness purpose I post an improvement on my suggestion MVBobj sent by email:
MVBobj wrote:It would work much better if we rephrased:

Code: Select all

    LabelText:=LabelText+'    ·';
to:

Code: Select all

    LabelText:=LabelText+'    '+Chr(0);
which simply places a non-visible null character at the end thereby preventing trimming.

This works adequately.
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