TAChart: Convert TBasicChartSeries.GetGraphBounds to a public function

git-svn-id: trunk@38477 -
This commit is contained in:
ask 2012-09-02 06:29:10 +00:00
parent 995b5a3d55
commit 8e2e2f20a6
2 changed files with 8 additions and 9 deletions

View File

@ -59,7 +59,6 @@ type
protected protected
procedure AfterAdd; override; procedure AfterAdd; override;
procedure GetGraphBounds(var ABounds: TDoubleRect); override;
procedure GetLegendItems(AItems: TChartLegendItems); virtual; abstract; procedure GetLegendItems(AItems: TChartLegendItems); virtual; abstract;
procedure GetLegendItemsBasic(AItems: TChartLegendItems); override; procedure GetLegendItemsBasic(AItems: TChartLegendItems); override;
function GetShowInLegend: Boolean; override; function GetShowInLegend: Boolean; override;
@ -88,6 +87,7 @@ type
function AxisToGraphY(AY: Double): Double; override; function AxisToGraphY(AY: Double): Double; override;
function GetAxisX: TChartAxis; function GetAxisX: TChartAxis;
function GetAxisY: TChartAxis; function GetAxisY: TChartAxis;
function GetGraphBounds: TDoubleRect; override;
function GraphToAxis(APoint: TDoublePoint): TDoublePoint; function GraphToAxis(APoint: TDoublePoint): TDoublePoint;
function GraphToAxisX(AX: Double): Double; override; function GraphToAxisX(AX: Double): Double; override;
function GraphToAxisY(AY: Double): Double; override; function GraphToAxisY(AY: Double): Double; override;
@ -339,10 +339,11 @@ begin
Result := FChart.LeftAxis; Result := FChart.LeftAxis;
end; end;
procedure TCustomChartSeries.GetGraphBounds(var ABounds: TDoubleRect); function TCustomChartSeries.GetGraphBounds: TDoubleRect;
begin begin
GetBounds(ABounds); Result := EmptyExtent;
with ABounds do begin GetBounds(Result);
with Result do begin
UpdateBoundsByAxisRange(FChart.AxisList, AxisIndexX, a.X, b.X); UpdateBoundsByAxisRange(FChart.AxisList, AxisIndexX, a.X, b.X);
UpdateBoundsByAxisRange(FChart.AxisList, AxisIndexY, a.Y, b.Y); UpdateBoundsByAxisRange(FChart.AxisList, AxisIndexY, a.Y, b.Y);
TransformByAxis(FChart.AxisList, AxisIndexX).UpdateBounds(a.X, b.X); TransformByAxis(FChart.AxisList, AxisIndexX).UpdateBounds(a.X, b.X);

View File

@ -56,7 +56,6 @@ type
// Set series bounds in axis coordinates. // Set series bounds in axis coordinates.
// Some or all bounds may be left unset, in which case they will be ignored. // Some or all bounds may be left unset, in which case they will be ignored.
procedure GetBounds(var ABounds: TDoubleRect); virtual; abstract; procedure GetBounds(var ABounds: TDoubleRect); virtual; abstract;
procedure GetGraphBounds(var ABounds: TDoubleRect); virtual; abstract;
procedure GetLegendItemsBasic(AItems: TChartLegendItems); virtual; abstract; procedure GetLegendItemsBasic(AItems: TChartLegendItems); virtual; abstract;
function GetShowInLegend: Boolean; virtual; abstract; function GetShowInLegend: Boolean; virtual; abstract;
procedure SetActive(AValue: Boolean); virtual; abstract; procedure SetActive(AValue: Boolean); virtual; abstract;
@ -79,6 +78,7 @@ type
public public
procedure Draw(ADrawer: IChartDrawer); virtual; abstract; procedure Draw(ADrawer: IChartDrawer); virtual; abstract;
function GetGraphBounds: TDoubleRect; virtual; abstract;
function IsEmpty: Boolean; virtual; abstract; function IsEmpty: Boolean; virtual; abstract;
procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); virtual; procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); virtual;
@ -947,7 +947,7 @@ function TChart.GetFullExtent: TDoubleRect;
end; end;
var var
seriesBounds, axisBounds: TDoubleRect; axisBounds: TDoubleRect;
s: TBasicChartSeries; s: TBasicChartSeries;
a: TChartAxis; a: TChartAxis;
begin begin
@ -960,14 +960,12 @@ begin
Result := EmptyExtent; Result := EmptyExtent;
for s in Series do begin for s in Series do begin
if not s.Active then continue; if not s.Active then continue;
seriesBounds := EmptyExtent;
try try
s.GetGraphBounds(seriesBounds); JoinBounds(s.GetGraphBounds);
except except
s.Active := false; s.Active := false;
raise; raise;
end; end;
JoinBounds(seriesBounds);
end; end;
for a in AxisList do begin for a in AxisList do begin
axisBounds := EmptyExtent; axisBounds := EmptyExtent;