Hi,
Sometimes I see a problem with the axis labels overlapping the axis title when I set Axis.LabelsSize := 0. The solution is to set Axis.LabelsSize to another value. The problem is that I don't know what that value should be until I look at all of the values in the GetAxisLabel event handler.
My problem is that setting Axis.LabelsSize at that point seems to be too late to have any affect.
How do I get this to work properly?
Regards,
Bill
When to set Axis.LabelsSize
Another way to demonstrate this problem is to set Axis.LabelsSize := 0 and then modify the LabelText value from within the GetAxisLabel event handler. If you append some characters to the LabelText value, there will definately be a big overlap issue with the axis title.
It seems to me that currently the space alloted to the axis labels is determined "before" the GetAxisLabel event handler is called. I think it needs to be determined "after" the GetAxisLabel event handler is called.
Bill
It seems to me that currently the space alloted to the axis labels is determined "before" the GetAxisLabel event handler is called. I think it needs to be determined "after" the GetAxisLabel event handler is called.
Bill
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Bill,
It works fine here using something like the code below. In the OnAfterDraw event LabelsSize is assigned to a value related to MaxLabelsWidth property. To force this being applied to the chart I called TChart's Draw method in the form's OnCreate event.
It works fine here using something like the code below. In the OnAfterDraw event LabelsSize is assigned to a value related to MaxLabelsWidth property. To force this being applied to the chart I called TChart's Draw method in the form's OnCreate event.
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
for i:=0 to 100 do
Series1.Add(i/10);
Chart1.Draw;
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
Chart1.Axes.Left.LabelsSize := Chart1.Axes.Left.MaxLabelsWidth*2;
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 |
Instructions - How to post in this forum |