TAChart: Check that Chart.Extent buonds are ordered corectly.

git-svn-id: trunk@19604 -
This commit is contained in:
ask 2009-04-24 11:35:33 +00:00
parent 56cc734a27
commit a258bd419f
2 changed files with 18 additions and 0 deletions

View File

@ -1241,6 +1241,7 @@ begin
FYGraphMax := FCurrentExtent.b.Y;
exit;
end;
Extent.CheckBoundsOrder;
// Search # of points, min and max of all series
FXGraphMin := Infinity;

View File

@ -241,6 +241,8 @@ type
property Visible default true;
end;
EExtentError = class(EChartError);
{ TChartExtent }
TChartExtent = class (TChartElement)
@ -253,6 +255,7 @@ type
procedure SetBounds(AIndex: Integer; const AValue: Double);
procedure SetUseBounds(AIndex: Integer; AValue: Boolean);
public
procedure CheckBoundsOrder;
property Extent: TDoubleRect read FExtent;
published
property XMin: Double index 1 read GetBounds write SetBounds;
@ -780,6 +783,20 @@ begin
Result := FUseBounds[AIndex];
end;
procedure TChartExtent.CheckBoundsOrder;
begin
if UseXMin and UseXMax and (XMin >= XMax) then begin
UseXMin := false;
UseXMax := false;
raise EExtentError.Create('ChartExtent: XMin >= XMax');
end;
if UseYMin and UseYMax and (YMin >= YMax) then begin
UseYMin := false;
UseYMax := false;
raise EExtentError.Create('ChartExtent: YMin >= YMax');
end;
end;
function TChartExtent.GetBounds(AIndex: Integer): Double;
begin
Result := FExtent.coords[AIndex];