Axis.LabelsOnAxis does nothing

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
fnn
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

Axis.LabelsOnAxis does nothing

Post by fnn » Tue Feb 28, 2006 8:42 am

Hello,
Axis.LabelsOnAxis is only used in InternalDrawLabel
LabelsOnAxis may be useful to not show labels out of Axis.MinimumOfset and Axis.MaximumOfset.

Also all labels should be in Axis.IStartPos and Axis.EndPos
Also Minimum Label rectangle should start Axis.EndPos to prove that multiple axis labels do not overlap.

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Mar 02, 2006 10:50 am

Hi,

LabelsOnAxis may be useful to not show labels out of Axis.MinimumOfset and Axis.MaximumOfset.

The LabelsOnAxis property does not check this, as designed, but this can be solved by using the OnGetAxisLabel event :
if StrToFloat(labeltext) < Chart1.Axes.Bottom.Minimum then
labeltext := '';

>Also all labels should be in Axis.IStartPos and Axis.EndPos
I'm not sure what you refer here ..

>Also Minimum Label rectangle should start Axis.EndPos to prove that >multiple axis labels do not overlap.
You could solve this by setting an offset

fnn
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

LabelsOnAxis

Post by fnn » Wed Mar 08, 2006 7:45 am

Firstly, StrToFloat(labeltext) is string.
It should be a double value to compare with Chart1.Axes.Bottom.Minimum.

Secondly,
For Chart1.Axes.Bottom.Minimum,
setting labeltext= '' has a potential problem.
Axis.MaxLabelWidth property uses mininum value.
So, Axis.MaxLabelWidth may be zero or less than actual value

>Also all labels should be in Axis.IStartPos and Axis.EndPos
>I'm not sure what you refer here ..
I have multiple vertical axes, their start and and position are same.
So sometimes, their minimum and maximum labels overlaps.
This proves that all labels are not in Axis.IStartPos and Axis.EndPos.

fnn
Newbie
Newbie
Posts: 10
Joined: Fri Nov 15, 2002 12:00 am

LabelsOnAxis

Post by fnn » Wed Mar 08, 2006 7:56 am

I solve my problem by changing source code as below
set FLabelsOnAxis=false


Procedure InternalDrawLabel(var Value:Double; DecValue:Boolean);
var tmp,s,e,h : Integer;
Begin
.....
h:=LabelHeight(Value)div 2;
if StartPosition=0 then
s:=0
else
s:=h;
if EndPosition=100 then
e:=0
else
e:=h;
if FLabelsOnAxis or ((tmp-s>IStartPos) and (tmp+e<IEndPos)) then
begin
....
end;
.....

Post Reply