mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 06:36:48 +02:00
TAChart: Fix chart margins calculation for axises with ZPosition > 0
git-svn-id: trunk@40110 -
This commit is contained in:
parent
ba96ce8bdd
commit
d6a519e428
@ -225,7 +225,8 @@ type
|
||||
procedure Draw(ACurrentZ: Integer; var AIndex: Integer);
|
||||
function GetAxisByAlign(AAlign: TChartAxisAlignment): TChartAxis;
|
||||
function GetEnumerator: TChartAxisEnumerator;
|
||||
function Measure(const AExtent: TDoubleRect): TChartAxisMargins;
|
||||
function Measure(
|
||||
const AExtent: TDoubleRect; ADepth: Integer): TChartAxisMargins;
|
||||
procedure Prepare(ARect: TRect);
|
||||
procedure PrepareGroups;
|
||||
procedure SetAxisByAlign(AAlign: TChartAxisAlignment; AValue: TChartAxis);
|
||||
@ -999,7 +1000,8 @@ begin
|
||||
AList.Sort(ACompare);
|
||||
end;
|
||||
|
||||
function TChartAxisList.Measure(const AExtent: TDoubleRect): TChartAxisMargins;
|
||||
function TChartAxisList.Measure(
|
||||
const AExtent: TDoubleRect; ADepth: Integer): TChartAxisMargins;
|
||||
var
|
||||
g: ^TChartAxisGroup;
|
||||
|
||||
@ -1009,6 +1011,8 @@ var
|
||||
Result[ALast] := Max(Result[ALast], g^.FLastMark);
|
||||
end;
|
||||
|
||||
const
|
||||
ALIGN_TO_ZDIR: array [TChartAxisAlignment] of Integer = (1, -1, -1, 1);
|
||||
var
|
||||
i, j, ai: Integer;
|
||||
axis: TChartAxis;
|
||||
@ -1034,7 +1038,9 @@ begin
|
||||
end;
|
||||
// Axises of the same group should have the same Alignment, Position and ZPosition.
|
||||
if axis.IsDefaultPosition then
|
||||
Result[axis.Alignment] += g^.FSize + g^.FTitleSize + g^.FMargin;
|
||||
Result[axis.Alignment] += Max(0,
|
||||
g^.FSize + g^.FTitleSize + g^.FMargin +
|
||||
ALIGN_TO_ZDIR[axis.Alignment] * Min(axis.ZPosition, ADepth));
|
||||
end;
|
||||
ai := 0;
|
||||
for i := 0 to High(FGroups) do begin
|
||||
|
@ -1235,7 +1235,7 @@ begin
|
||||
CalculateTransformationCoeffs(ZeroRect);
|
||||
cr := FClipRect;
|
||||
for tries := 1 to 10 do begin
|
||||
axisMargin := AxisList.Measure(CurrentExtent);
|
||||
axisMargin := AxisList.Measure(CurrentExtent, Depth);
|
||||
axisMargin[calLeft] := Max(axisMargin[calLeft], Depth);
|
||||
axisMargin[calBottom] := Max(axisMargin[calBottom], Depth);
|
||||
FClipRect := cr;
|
||||
|
Loading…
Reference in New Issue
Block a user