the title of left axis is overlapping the labels

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

the title of left axis is overlapping the labels

Post by franckgar » Thu Feb 09, 2006 3:39 pm

Hi,
I have a problem with the title of left axis. Sometimes the title is overlapping the labels, as you can see on this screenshoot :

[img]
http://cjoint.com/data/cjqDEF8DHg.htm
[/img]

I don't understand why .... as I set TChartAxis.TitleSize = 0 this must not happen.
Any solutions for this problem ?

Thanks
Franck

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

Post by Narcís » Thu Feb 09, 2006 4:18 pm

Hi Franck,

Yes, this is a known problem. In the meantime, you can solve that by setting the axis labels size:

Code: Select all

  Chart1.Axes.Left.LabelsSize:=30;
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

franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Post by franckgar » Fri Feb 10, 2006 9:03 am

yes of course I could manage it myself .... but as it's a bug of the graph, I really hope that it will be corrected in the next version.

bye
Franck

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

Post by Narcís » Fri Feb 10, 2006 10:04 am

Hi Franck,

Yes, as I told you, it's a known bug and it is already on our defect list to be fixed for future releases.
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

fabnav
Newbie
Newbie
Posts: 8
Joined: Thu Sep 30, 2004 4:00 am
Location: Northern Virginia

Post by fabnav » Mon Feb 20, 2006 6:56 pm

Hi,

I have the same problem, and setting the LabelsSize to a constant isn't a workaround to the bug. There needs to be a way to calculate how much space is used, and then add some to that.

Is there a way to determine the amount of space that is allocated to the axis labels so that we can add a little padding?

Regards,

Bill

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

Post by Narcís » Tue Feb 21, 2006 8:38 am

Hi Bill,

Yes, you can do something like this:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  for i:=0 to Chart1.SeriesCount-1 do
    Chart1[i].FillSampleValues();

  Chart1.Axes.Left.Title.Caption:='My left axis title';
  Chart1.Draw;
end;

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

fabnav
Newbie
Newbie
Posts: 8
Joined: Thu Sep 30, 2004 4:00 am
Location: Northern Virginia

Post by fabnav » Tue Feb 21, 2006 3:37 pm

It looks like you are assuming four pixels per character, but that won't always be the case.

In addition, using this event will be slow when there are a large number of points. It would probably work if only the labels being displayed triggered the event, but that isn't the case.

Bill

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

Post by Narcís » Tue Feb 21, 2006 4:39 pm

Hi Bill,
It looks like you are assuming four pixels per character, but that won't always be the case.
You can make this constant dependant of the font size or whatever you consider can affect that. It was just an idea to try to give a better workaround for the issue.
In addition, using this event will be slow when there are a large number of points. It would probably work if only the labels being displayed triggered the event, but that isn't the case.
This event is actually fired for all axes labels displayed but the code will only be executed for the left axis labels.
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