TeeChart Axis labels seem to be too aggressive in NOT drawing even when there is space when using LabelsAlternate.
In particular, even if you set LabelSeparation to the minimum non-zero value (1) and set LabelsAlternate to true it stops drawing some labels even if they should fit. I took a quick look at the source code and I think it does not take into account if labels alternate. Here is an example attached.
Any thoughts on whether this might get fixed or has anyone hacked the source to address this?
Axis Labels not drawing
Re: Axis Labels not drawing
Hello,
I've added it to the public tracker: #2775.
And already fixed it.
Here the diff if you want to apply it in your sources:
I've added it to the public tracker: #2775.
And already fixed it.
Here the diff if you want to apply it in your sources:
Code: Select all
--- a/TeEngine.pas
+++ b/TeEngine.pas
@@ -6963,11 +6963,11 @@ var
var
tmpLabelSize : Integer;
tmpLabelW : Boolean;
- OldPosLabel : Integer;
tmp : Integer;
- OldSizeLabel : Integer;
+ OldPosLabel : array [0..1] of Integer;
+ OldSizeLabel : array [0..1] of Integer;
- function DoesLabelFit(const ALabel:String):Boolean;
+ function DoesLabelFit(const ALabel:String; const ARow:Integer):Boolean;
var tmpNum : Integer;
begin
if tmpLabelW then
@@ -6978,15 +6978,15 @@ var
tmpLabelSize:=ParentChart.Canvas.FontHeight*tmpNum;
end;
- if (FLabels.Separation<>0) and (OldPosLabel<>-1) then
+ if (FLabels.Separation<>0) and (OldPosLabel[ARow]<>-1) then
begin
Inc(tmpLabelSize,Trunc(0.02*tmpLabelSize*FLabels.Separation));
tmpLabelSize:=tmpLabelSize div 2;
- if tmp>=OldPosLabel then
- result:=(tmp-tmpLabelSize)>=(OldPosLabel+OldSizeLabel)
+ if tmp>=OldPosLabel[ARow] then
+ result:=(tmp-tmpLabelSize)>=(OldPosLabel[ARow]+OldSizeLabel[ARow])
else
- result:=(tmp+tmpLabelSize)<=(OldPosLabel-OldSizeLabel);
+ result:=(tmp+tmpLabelSize)<=(OldPosLabel[ARow]-OldSizeLabel[ARow]);
end
else
result:=True;
@@ -7032,6 +7032,7 @@ var
tmpSt2 : String;
tmpPicture : TTeePicture;
tmpDuplicated: Boolean;
+ tmpRow : Integer;
begin
CalcAllSeries;
CalcFirstLastAllSeries(tmpFirst,tmpLast);
@@ -7054,8 +7055,11 @@ var
for s:=0 to ISeriesList.Count-1 do
begin
- OldPosLabel :=-1;
- OldSizeLabel:= 0;
+ OldPosLabel[0] :=-1;
+ OldPosLabel[1] :=-1;
+ OldSizeLabel[0]:= 0;
+ OldSizeLabel[1]:= 0;
+ tmpRow:=0;
t:=tmpFirst;
@@ -7073,9 +7077,9 @@ var
if FLabels.Visible and (tmpSt<>'') then
begin
- tmpDraw:=DoesLabelFit(tmpSt);
+ tmpDraw:=DoesLabelFit(tmpSt, tmpRow);
- if (FLabels.Separation<>0) and (OldPosLabel<>-1) then
+ if (FLabels.Separation<>0) and (OldPosLabel[tmpRow]<>-1) then
begin
if (not tmpDraw) and Texts.Automatic.Trim then
begin
@@ -7084,7 +7088,7 @@ var
while tmpSt2<>'' do
begin
Delete(tmpSt2,Length(tmpSt2),1);
- tmpDraw:=DoesLabelFit(tmpSt2);
+ tmpDraw:=DoesLabelFit(tmpSt2, tmpRow);
if tmpDraw then
begin
@@ -7099,8 +7103,11 @@ var
if not tmpDuplicated then
AddTickAndSaveLabel(tmpValue,tmp,tmpSt,tmpPicture);
- OldPosLabel:=tmp;
- OldSizeLabel:=tmpLabelSize;
+ OldPosLabel[tmpRow]:=tmp;
+ OldSizeLabel[tmpRow]:=tmpLabelSize;
+
+ if LabelsAlternate then
+ tmpRow:=(tmpRow+1) mod 2;
end;
end
else
@@ -7108,8 +7115,11 @@ var
if not tmpDuplicated then
AddTickAndSaveLabel(tmpValue,tmp,tmpSt,tmpPicture);
- OldPosLabel:=tmp;
- OldSizeLabel:=tmpLabelSize div 2;
+ OldPosLabel[tmpRow]:=tmp;
+ OldSizeLabel[tmpRow]:=tmpLabelSize div 2;
+
+ if LabelsAlternate then
+ tmpRow:=(tmpRow+1) mod 2;
end;
end;
end;
--
Best Regards,
![]() | Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) |
![]() ![]() ![]() ![]() ![]() ![]() |
Please read our Bug Fixing Policy |
-
- Newbie
- Posts: 12
- Joined: Thu Dec 05, 2019 12:00 am
Re: Axis Labels not drawing
Thanks!