mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 11:18:29 +02:00
TAChart: Add function TChartAxis.MeasureLabelSize based on code by forum user piola (https://forum.lazarus.freepascal.org/index.php/topic,46243.0.html).
git-svn-id: trunk@61690 -
This commit is contained in:
parent
90a7301300
commit
57dd9caaa1
@ -160,6 +160,7 @@ type
|
||||
function IsVertical: Boolean; inline;
|
||||
procedure Measure(
|
||||
const AExtent: TDoubleRect; var AMeasureData: TChartAxisGroup);
|
||||
function MeasureLabelSize(ADrawer: IChartDrawer): Integer;
|
||||
function PositionToCoord(const ARect: TRect): Integer;
|
||||
procedure PrepareHelper(
|
||||
ADrawer: IChartDrawer; const ATransf: ICoordTransformer;
|
||||
@ -875,6 +876,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TChartAxis.MeasureLabelSize(ADrawer: IChartDrawer): Integer;
|
||||
var
|
||||
sz: Integer;
|
||||
mv: TChartValueTextArray = nil;
|
||||
i: Integer;
|
||||
begin
|
||||
SetLength(mv, ValueCount);
|
||||
for i := 0 to ValueCount - 1 do
|
||||
mv[i] := Value[i];
|
||||
sz := Marks.Measure(ADrawer, not IsVertical, TickLength, mv);
|
||||
Result := round(sz);
|
||||
end;
|
||||
|
||||
function TChartAxis.PositionIsStored: Boolean;
|
||||
begin
|
||||
Result := not SameValue(Position, 0.0);
|
||||
|
Loading…
Reference in New Issue
Block a user