Imagine a series (Bar Series) with every item having a label. We can set something like "labels -> min separation" of an axis. That's pretty cool. Instead of overlapping Labels, some are getting hidden.
Many thanks in advance
My question is: How can I find out whether all labels are still visible or if some got hidden?How to determine if all axis labels are visible?
-
- Newbie
- Posts: 60
- Joined: Fri Nov 22, 2013 12:00 am
Re: How to determine if all axis labels are visible?
Hi Jens,
You could check Chart1.Axes.Bottom.Items.Count as in the following example:
You could check Chart1.Axes.Bottom.Items.Count as in the following example:
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.Align:=alClient;
with Chart1.AddSeries(TBarSeries) do
begin
FillSampleValues(6);
Labels[0]:='Uno';
Labels[1]:='Dos';
Labels[2]:='Tres';
Labels[3]:='Cuatro';
Labels[4]:='Cinco';
Labels[5]:='Seis';
end;
TrackBar1.Max:=100;
TrackBar1.Min:=0;
TrackBar1.Position:=10;
TrackBar1.Frequency:=10;
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
Chart1.Axes.Bottom.LabelsSeparation:=TrackBar1.Position;
Label1.Caption:='Separation: ' + IntToStr(TrackBar1.Position) + ' %';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(IntToStr(Chart1.Axes.Bottom.Items.Count) + '/' + IntToStr(Chart1[0].Count) + ' labels drawn');
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 60
- Joined: Fri Nov 22, 2013 12:00 am
Re: How to determine if all axis labels are visible?
The Items of the Axis, of course!
Thank you very much for this elaborate example
Thank you very much for this elaborate example