Page 1 of 1

Reduce the number of axis labels ?

Posted: Wed Feb 13, 2008 8:11 pm
by 9349911
Hi support,

we use several custom axis in our application. And in some cases there are to many labels at the axis.

Is it possible to set a maximum of labels per axis? This would be better readable for the user especially if you have more than three y-axis.

If needed I can post an exampleimage.

Posted: Thu Feb 14, 2008 11:03 am
by yeray
Hi Dominik,

Here you have different options:

- You could simply modify the PositionPercent of the axes:

Code: Select all

  Chart1.MarginLeft := 15;
  Chart1.CustomAxes[0].PositionPercent := -8;
  Chart1.CustomAxes[1].PositionPercent := -16;
- You could use OnGetAxisLabel event to change LabelText manually. But note that here you need to set LabelStyle to talText (so, your values must have labeltext set).
In the following example I hide the even values (in order of points addition to series).

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Axes.Left.LabelStyle := talText;
end;

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  if sender = Series1.GetVertAxis then
    if (ValueIndex < 0) or (ValueIndex mod 2 = 0) then
      LabelText := ''
    else
      LabelText := Series1.Labels[ValueIndex];
end;

Posted: Mon Mar 03, 2008 11:25 am
by 9349911
Hi Yeray,

I´ve tested your solutions but that´s not what I need ...

Your first solution is not useable. It just sets some margins to the chart and the Axis.
Your second solution won´t work for me.

But I found a "half" solution in the meantime. It helps alot if I set the minimum distance (in %) at 100% for the axis label.

But this is only one step and there are other problems. See the following picture:
Image

I set the value format for both axis to #.##0,0 which is a common format in our application. If you have a big axis you will see double entries like on the picture.

This is really confusing for users.

So how can I disable the double values? It would be great if only the first one would be shown. So if yo have values like this:

Code: Select all

3,7
3,7
3,7
3,6
3,6
3,6
3,5
3,5
3,5
it sould be display in this form:

Code: Select all

           <-- deleted
           <-- deleted
3,7
           <-- deleted 
           <-- deleted
3,6
           <-- deleted
           <-- deleted
3,5
Could you please give me an example how to achieve this?

Posted: Mon Mar 03, 2008 11:52 am
by narcis
Hi Dominik,

You could try setting specific Increment depending on what's displayed on your chart. In the image you sent you could try setting Increment to 0.1 to remove the labels you mentioned.