Page 1 of 1

Put space between LeftAxisLabel and Ticks

Posted: Tue Aug 04, 2015 2:59 pm
by 16475083
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.

Re: Put space between LeftAxisLabel and Ticks

Posted: Tue Aug 04, 2015 3:00 pm
by narcis
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;

Re: Put space between LeftAxisLabel and Ticks

Posted: Wed Aug 05, 2015 7:18 am
by narcis
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.