mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 22:00:10 +02:00
TAChart: Add helper methods ZoomPercent and UndoZoom to TAChartTeeChart for improved Delphi compatibility.
git-svn-id: trunk@60056 -
This commit is contained in:
parent
4bb9801bf9
commit
7226642cf1
@ -28,6 +28,8 @@ type
|
||||
function GetMargin(AIndex: Integer): Integer; inline;
|
||||
procedure SetMargin(AIndex: Integer; AValue: TChartDistance); inline;
|
||||
public
|
||||
procedure UndoZoom;
|
||||
procedure ZoomPercent(const PercentZoom: Double);
|
||||
property RightAxis: TChartAxis index calRight read GetAxisByAlign1;
|
||||
property TopAxis: TChartAxis index calTop read GetAxisByAlign1;
|
||||
public
|
||||
@ -80,7 +82,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math;
|
||||
Math, TAGeometry;
|
||||
|
||||
type
|
||||
TLogTransformEnumerator = class(TAxisTransformEnumerator)
|
||||
@ -198,6 +200,25 @@ begin
|
||||
Margins.SetValue(AIndex, AValue);
|
||||
end;
|
||||
|
||||
procedure TChartTeeChart.UndoZoom;
|
||||
begin
|
||||
ZoomFull;
|
||||
end;
|
||||
|
||||
procedure TChartTeeChart.ZoomPercent(const PercentZoom: Double);
|
||||
var
|
||||
ext: TDoubleRect;
|
||||
factor: Double;
|
||||
dx, dy: Double;
|
||||
begin
|
||||
if PercentZoom <= 0 then exit;
|
||||
factor := (1.0 - PercentZoom * 0.01) * 0.5;
|
||||
ext := LogicalExtent;
|
||||
dx := (ext.b.x - ext.a.x) * factor;
|
||||
dy := (ext.b.y - ext.a.y) * factor;
|
||||
LogicalExtent := DoubleRect(ext.a.x - dx, ext.a.y - dy, ext.b.x + dx, ext.b.y + dy);
|
||||
end;
|
||||
|
||||
procedure Dummy;
|
||||
begin
|
||||
// Workaround for issue #21808.
|
||||
|
Loading…
Reference in New Issue
Block a user