mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 03:40:28 +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;
|
function GetMargin(AIndex: Integer): Integer; inline;
|
||||||
procedure SetMargin(AIndex: Integer; AValue: TChartDistance); inline;
|
procedure SetMargin(AIndex: Integer; AValue: TChartDistance); inline;
|
||||||
public
|
public
|
||||||
|
procedure UndoZoom;
|
||||||
|
procedure ZoomPercent(const PercentZoom: Double);
|
||||||
property RightAxis: TChartAxis index calRight read GetAxisByAlign1;
|
property RightAxis: TChartAxis index calRight read GetAxisByAlign1;
|
||||||
property TopAxis: TChartAxis index calTop read GetAxisByAlign1;
|
property TopAxis: TChartAxis index calTop read GetAxisByAlign1;
|
||||||
public
|
public
|
||||||
@ -80,7 +82,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math;
|
Math, TAGeometry;
|
||||||
|
|
||||||
type
|
type
|
||||||
TLogTransformEnumerator = class(TAxisTransformEnumerator)
|
TLogTransformEnumerator = class(TAxisTransformEnumerator)
|
||||||
@ -198,6 +200,25 @@ begin
|
|||||||
Margins.SetValue(AIndex, AValue);
|
Margins.SetValue(AIndex, AValue);
|
||||||
end;
|
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;
|
procedure Dummy;
|
||||||
begin
|
begin
|
||||||
// Workaround for issue #21808.
|
// Workaround for issue #21808.
|
||||||
|
Loading…
Reference in New Issue
Block a user