mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-16 10:19:25 +02:00
TAChart: Extract public function TChart.GetLegendItems
git-svn-id: trunk@31334 -
This commit is contained in:
parent
32a183ceaa
commit
80521e30cc
@ -28,7 +28,7 @@ unit TAGraph;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Graphics, Classes, Controls, LCLType, SysUtils,
|
Graphics, Classes, Contnrs, Controls, LCLType, SysUtils,
|
||||||
TAChartAxis, TAChartUtils, TADrawUtils, TALegend, TATypes;
|
TAChartAxis, TAChartUtils, TADrawUtils, TALegend, TATypes;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -279,6 +279,7 @@ type
|
|||||||
procedure DrawLegendOn(ACanvas: TCanvas; var ARect: TRect);
|
procedure DrawLegendOn(ACanvas: TCanvas; var ARect: TRect);
|
||||||
procedure EnableRedrawing;
|
procedure EnableRedrawing;
|
||||||
function GetFullExtent: TDoubleRect;
|
function GetFullExtent: TDoubleRect;
|
||||||
|
function GetLegendItems: TObjectList;
|
||||||
procedure PaintOnAuxCanvas(ACanvas: TCanvas; ARect: TRect);
|
procedure PaintOnAuxCanvas(ACanvas: TCanvas; ARect: TRect);
|
||||||
procedure PaintOnCanvas(ACanvas: TCanvas; ARect: TRect);
|
procedure PaintOnCanvas(ACanvas: TCanvas; ARect: TRect);
|
||||||
procedure SaveToBitmapFile(const AFileName: String); inline;
|
procedure SaveToBitmapFile(const AFileName: String); inline;
|
||||||
@ -286,9 +287,7 @@ 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;
|
||||||
@ -308,6 +307,8 @@ type
|
|||||||
property LogicalExtent: TDoubleRect read FLogicalExtent write SetLogicalExtent;
|
property LogicalExtent: TDoubleRect read FLogicalExtent write SetLogicalExtent;
|
||||||
property OnChartPaint: TChartPaintEvent
|
property OnChartPaint: TChartPaintEvent
|
||||||
read FOnChartPaint write SetOnChartPaint; experimental;
|
read FOnChartPaint write SetOnChartPaint; experimental;
|
||||||
|
property RenderingParams: TChartRenderingParams
|
||||||
|
read GetRenderingParams write SetRenderingParams;
|
||||||
property ReticulePos: TPoint read FReticulePos write SetReticulePos;
|
property ReticulePos: TPoint read FReticulePos write SetReticulePos;
|
||||||
property SeriesCount: Integer read GetSeriesCount;
|
property SeriesCount: Integer read GetSeriesCount;
|
||||||
property XGraphMax: Double read FCurrentExtent.b.X;
|
property XGraphMax: Double read FCurrentExtent.b.X;
|
||||||
@ -923,6 +924,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TChart.GetLegendItems: TObjectList;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result := TChartLegendItems.Create;
|
||||||
|
try
|
||||||
|
for i := 0 to SeriesCount - 1 do
|
||||||
|
with Series[i] do
|
||||||
|
if Active and GetShowInLegend then
|
||||||
|
GetLegendItemsBasic(Result);
|
||||||
|
except
|
||||||
|
FreeAndNil(Result);
|
||||||
|
raise;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TChart.GetMargins(ADrawer: IChartDrawer): TRect;
|
function TChart.GetMargins(ADrawer: IChartDrawer): TRect;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -1083,15 +1100,9 @@ end;
|
|||||||
procedure TChart.PrepareLegend(
|
procedure TChart.PrepareLegend(
|
||||||
ADrawer: IChartDrawer; out ALegendItems: TChartLegendItems;
|
ADrawer: IChartDrawer; out ALegendItems: TChartLegendItems;
|
||||||
var AClipRect: TRect; out ALegendRect: TRect);
|
var AClipRect: TRect; out ALegendRect: TRect);
|
||||||
var
|
|
||||||
i: Integer;
|
|
||||||
begin
|
begin
|
||||||
ALegendItems := TChartLegendItems.Create;
|
ALegendItems := GetLegendItems;
|
||||||
try
|
try
|
||||||
for i := 0 to SeriesCount - 1 do
|
|
||||||
with Series[i] do
|
|
||||||
if Active and GetShowInLegend then
|
|
||||||
GetLegendItemsBasic(ALegendItems);
|
|
||||||
ALegendRect := Legend.Prepare(ADrawer, ALegendItems, AClipRect);
|
ALegendRect := Legend.Prepare(ADrawer, ALegendItems, AClipRect);
|
||||||
except
|
except
|
||||||
FreeAndNil(ALegendItems);
|
FreeAndNil(ALegendItems);
|
||||||
|
Loading…
Reference in New Issue
Block a user