LabelText := '' stops further labels from displaying

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

LabelText := '' stops further labels from displaying

Post by SteveP » Wed May 25, 2005 7:32 pm

Setting LabelText := '' in a chart's OnGetAxisLabel event causes axis labels to not be displayed in some cases. If this is done as a result of checking whether the label is a floating point number, then axis labels are not shown. For example :

for i := 0 to 5 do series1.AddXY(i,random(10));

and then in OnGetAxisLabel event saying either :

if trunc(strtofloat(LabelText)) <> strtofloat(LabelText) then LabelText := ''

or :

if pos('.', labeltext) <> 0 then LabelText := '';

causes the integer labels 2,3,4 to not be displayed. The OnGetAxisLabel event is not even fired for them. This appears to be due to the initial lables for the charts being floating point numbers (5.03 and -0.03) as seen by adding the LabelText to a memo in this event. Setting LabelText to a space character instead of an empty string avoids this problem.

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 May 27, 2005 10:22 am

Hi Steve,

If you don't want to display decimal values at axes labels you could use:

Code: Select all

  Chart1.Axes.Left.AxisValuesFormat:='##';
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

SteveP
Advanced
Posts: 132
Joined: Sun Sep 07, 2003 4:00 am

Post by SteveP » Fri May 27, 2005 1:20 pm

Narcis,

This would show 2.5 as 2. Then, the axis value of 2.0 also appears as 2 and so two axis labels with the same text appear. I do not want any label shown for decimal labels, but I do want the tick mark. Things are working by specifying a space character instead of empty string.

Steve

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

Post by Narcís » Mon May 30, 2005 10:28 am

Hi Steve,

Yes, you are right. I've been able to reproduce this and already added it to our deffect 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

Post Reply