TAChart: Fix missing minor ticks when an axis is inverted by means of a linear axis transform. Issue #39546.

(cherry picked from commit b8f2e92f03)
This commit is contained in:
wp_xyz 2022-01-11 12:07:20 +01:00 committed by Maxim Ganetsky
parent 191e203993
commit aabe4314d5

View File

@ -574,6 +574,8 @@ procedure TChartAxis.Draw;
j: Integer;
minorMarks: TChartValueTextArray;
m: TChartValueText;
isFlipped: Boolean;
trMin, trMax: Double;
begin
if IsNan(AMin) or (AMin = AMax) then exit;
for j := 0 to Minors.Count - 1 do begin
@ -582,10 +584,15 @@ procedure TChartAxis.Draw;
with FHelper.Clone do
try
FAxis := Minors[j];
trMin := FAxisTransf(AMin);
trMax := FAxisTransf(AMax);
// Only draw minor marks strictly inside the major mark interval.
FValueMin := Max(FAxisTransf(AMin), FValueMin);
FValueMax := Min(FAxisTransf(AMax), FValueMax);
if FValueMax <= FValueMin then
isFlipped := (AMin < AMax) and (trMin > trMax);
FValueMin := Max(trMin, FValueMin);
FValueMax := Min(trMax, FValueMax);
if (not isFlipped and (FValueMax <= FValueMin)) or
(isFlipped and (FValueMax >= FValueMin))
then
continue;
ExpandRange(FValueMin, FValueMax, -EPS);
FClipRangeDelta := 1;