mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 20:09:10 +02:00
TAChart: Add Chart.RenderingParams property
git-svn-id: trunk@30199 -
This commit is contained in:
parent
c6bdd569fa
commit
eda3f30176
@ -141,6 +141,13 @@ type
|
|||||||
ASender: TChart; const ARect: TRect;
|
ASender: TChart; const ARect: TRect;
|
||||||
var ADoDefaultDrawing: Boolean) of object;
|
var ADoDefaultDrawing: Boolean) of object;
|
||||||
|
|
||||||
|
TChartRenderingParams = record
|
||||||
|
FClipRect: TRect;
|
||||||
|
FIsZoomed: Boolean;
|
||||||
|
FLogicalExtent, FPrevLogicalExtent: TDoubleRect;
|
||||||
|
FScale, FOffset: TDoublePoint;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TChart }
|
{ TChart }
|
||||||
|
|
||||||
TChart = class(TCustomChart, ICoordTransformer)
|
TChart = class(TCustomChart, ICoordTransformer)
|
||||||
@ -195,6 +202,7 @@ type
|
|||||||
function GetChartHeight: Integer;
|
function GetChartHeight: Integer;
|
||||||
function GetChartWidth: Integer;
|
function GetChartWidth: Integer;
|
||||||
function GetMargins(ADrawer: IChartDrawer): TRect;
|
function GetMargins(ADrawer: IChartDrawer): TRect;
|
||||||
|
function GetRenderingParams: TChartRenderingParams;
|
||||||
function GetSeriesCount: Integer;
|
function GetSeriesCount: Integer;
|
||||||
function GetToolset: TBasicChartToolset;
|
function GetToolset: TBasicChartToolset;
|
||||||
procedure HideReticule;
|
procedure HideReticule;
|
||||||
@ -219,6 +227,7 @@ type
|
|||||||
procedure SetOnChartPaint(AValue: TChartPaintEvent);
|
procedure SetOnChartPaint(AValue: TChartPaintEvent);
|
||||||
procedure SetOnDrawReticule(AValue: TDrawReticuleEvent);
|
procedure SetOnDrawReticule(AValue: TDrawReticuleEvent);
|
||||||
procedure SetProportional(AValue: Boolean);
|
procedure SetProportional(AValue: Boolean);
|
||||||
|
procedure SetRenderingParams(AValue: TChartRenderingParams);
|
||||||
procedure SetReticuleMode(const AValue: TReticuleMode);
|
procedure SetReticuleMode(const AValue: TReticuleMode);
|
||||||
procedure SetReticulePos(const AValue: TPoint);
|
procedure SetReticulePos(const AValue: TPoint);
|
||||||
procedure SetTitle(Value: TChartTitle);
|
procedure SetTitle(Value: TChartTitle);
|
||||||
@ -274,6 +283,9 @@ type
|
|||||||
function SaveToImage(AClass: TRasterImageClass): TRasterImage;
|
function SaveToImage(AClass: TRasterImageClass): TRasterImage;
|
||||||
procedure StyleChanged(Sender: TObject); override;
|
procedure StyleChanged(Sender: TObject); override;
|
||||||
procedure ZoomFull; override;
|
procedure ZoomFull; override;
|
||||||
|
public
|
||||||
|
property RenderingParams: TChartRenderingParams
|
||||||
|
read GetRenderingParams write SetRenderingParams;
|
||||||
public // Coordinate conversion
|
public // Coordinate conversion
|
||||||
function GraphToImage(const AGraphPoint: TDoublePoint): TPoint;
|
function GraphToImage(const AGraphPoint: TDoublePoint): TPoint;
|
||||||
function ImageToGraph(const APoint: TPoint): TDoublePoint;
|
function ImageToGraph(const APoint: TPoint): TDoublePoint;
|
||||||
@ -914,6 +926,16 @@ begin
|
|||||||
a[i] := ADrawer.Scale(a[i]);
|
a[i] := ADrawer.Scale(a[i]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TChart.GetRenderingParams: TChartRenderingParams;
|
||||||
|
begin
|
||||||
|
Result.FScale := FScale;
|
||||||
|
Result.FOffset := FOffset;
|
||||||
|
Result.FClipRect := FClipRect;
|
||||||
|
Result.FLogicalExtent := FLogicalExtent;
|
||||||
|
Result.FPrevLogicalExtent := FPrevLogicalExtent;
|
||||||
|
Result.FIsZoomed := FIsZoomed;
|
||||||
|
end;
|
||||||
|
|
||||||
function TChart.GetSeriesCount: Integer;
|
function TChart.GetSeriesCount: Integer;
|
||||||
begin
|
begin
|
||||||
Result := FSeries.FList.Count;
|
Result := FSeries.FList.Count;
|
||||||
@ -987,29 +1009,15 @@ end;
|
|||||||
|
|
||||||
procedure TChart.PaintOnAuxCanvas(ACanvas: TCanvas; ARect: TRect);
|
procedure TChart.PaintOnAuxCanvas(ACanvas: TCanvas; ARect: TRect);
|
||||||
var
|
var
|
||||||
oldScale, oldOffset: TDoublePoint;
|
rp: TChartRenderingParams;
|
||||||
oldClipRect: TRect;
|
|
||||||
oldLogicalExtent, oldPrevLogicalExtent: TDoubleRect;
|
|
||||||
oldIsZoomed: Boolean;
|
|
||||||
begin
|
begin
|
||||||
// TODO: Group rendering params into a structure.
|
rp := RenderingParams;
|
||||||
oldScale := FScale;
|
|
||||||
oldOffset := FOffset;
|
|
||||||
oldClipRect := FClipRect;
|
|
||||||
oldLogicalExtent := FLogicalExtent;
|
|
||||||
oldPrevLogicalExtent := FPrevLogicalExtent;
|
|
||||||
oldIsZoomed := FIsZoomed;
|
|
||||||
ExtentBroadcaster.Locked := true;
|
ExtentBroadcaster.Locked := true;
|
||||||
try
|
try
|
||||||
FIsZoomed := false;
|
FIsZoomed := false;
|
||||||
PaintOnCanvas(ACanvas, ARect);
|
PaintOnCanvas(ACanvas, ARect);
|
||||||
finally
|
finally
|
||||||
FScale := oldScale;
|
RenderingParams := rp;
|
||||||
FOffset := oldOffset;
|
|
||||||
FClipRect := oldClipRect;
|
|
||||||
FLogicalExtent := oldLogicalExtent;
|
|
||||||
FPrevLogicalExtent := oldPrevLogicalExtent;
|
|
||||||
FIsZoomed := oldIsZoomed;
|
|
||||||
ExtentBroadcaster.Locked := false;
|
ExtentBroadcaster.Locked := false;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1244,6 +1252,16 @@ begin
|
|||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChart.SetRenderingParams(AValue: TChartRenderingParams);
|
||||||
|
begin
|
||||||
|
FScale := AValue.FScale;
|
||||||
|
FOffset := AValue.FOffset;
|
||||||
|
FClipRect := AValue.FClipRect;
|
||||||
|
FLogicalExtent := AValue.FLogicalExtent;
|
||||||
|
FPrevLogicalExtent := AValue.FPrevLogicalExtent;
|
||||||
|
FIsZoomed := AValue.FIsZoomed;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChart.SetReticuleMode(const AValue: TReticuleMode);
|
procedure TChart.SetReticuleMode(const AValue: TReticuleMode);
|
||||||
begin
|
begin
|
||||||
if FReticuleMode = AValue then exit;
|
if FReticuleMode = AValue then exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user