TAChart: Correctly measure axis titles

git-svn-id: trunk@31714 -
This commit is contained in:
ask 2011-07-16 18:34:15 +00:00
parent 9b3b52f19f
commit 938cbd7a55
2 changed files with 6 additions and 5 deletions

View File

@ -514,13 +514,14 @@ procedure TChartAxis.Measure(
end;
function TitleSize: Integer;
var
sz: TSize;
begin
if not Title.Visible or (Title.Caption = '') then
exit(0);
sz := Title.MeasureLabel(FHelper.FDrawer, Title.Caption);
Result := IfThen(IsVertical, sz.cx, sz.cy) + Title.Distance;
with Title.MeasureLabel(FHelper.FDrawer, Title.Caption) do
Result := IfThen(IsVertical, cx, cy);
if Title.DistanceToCenter then
Result := Result div 2;
Result += FHelper.FDrawer.Scale(Title.Distance);
end;
function FirstLastSize(AIndex: Integer): Integer;

View File

@ -1127,10 +1127,10 @@ begin
CalculateTransformationCoeffs(Rect(0, 0, 0, 0));
cr := FClipRect;
for tries := 1 to 10 do begin
FClipRect := cr;
axisMargin := AxisList.Measure(CurrentExtent);
axisMargin[calLeft] := Max(axisMargin[calLeft], Depth);
axisMargin[calBottom] := Max(axisMargin[calBottom], Depth);
FClipRect := cr;
for aa := Low(aa) to High(aa) do
SideByAlignment(FClipRect, aa, -axisMargin[aa]);
prevExt := FCurrentExtent;