TAChart: Use EnsureOrder and NormalizeRect throughout the code

git-svn-id: trunk@25919 -
This commit is contained in:
ask 2010-06-05 14:22:22 +00:00
parent 89e0f1b9ba
commit d6b37e7cb4
4 changed files with 5 additions and 11 deletions

View File

@ -485,8 +485,7 @@ var
begin
AMin := GetTransform.GraphToAxis(AMin);
AMax := GetTransform.GraphToAxis(AMax);
if AMin > AMax then
Exchange(AMin, AMax);
EnsureOrder(AMin, AMax);
Marks.SourceDef.ValuesInRange(
AMin, AMax, Marks.Format, IsVertical, FMarkValues, FMarkTexts);
if Inverted then

View File

@ -558,8 +558,8 @@ function RectIntersectsRect(
function RangesIntersect(L1, R1, L2, R2: Double; out L, R: Double): Boolean;
begin
if L1 > R1 then Exchange(L1, R1);
if L2 > R2 then Exchange(L2, R2);
EnsureOrder(L1, R1);
EnsureOrder(L2, R2);
L := Max(L1, L2);
R := Min(R1, R2);
Result := L <= R;

View File

@ -1021,7 +1021,7 @@ procedure TChart.UpdateExtent;
AHi += DEFAULT_WIDTH / 2;
end
else begin
if ALo > AHi then Exchange(ALo, AHi);
EnsureOrder(ALo, AHi);
// Expand view slightly to avoid data points on the chart edge.
ExpandRange(ALo, AHi, ExpandPercentage * PERCENT);
end;

View File

@ -659,12 +659,7 @@ begin
ext.a := FChart.ImageToGraph(TopLeft);
ext.b := FChart.ImageToGraph(BottomRight);
end;
with ext do begin
if a.X > b.X then
Exchange(a.X, b.X);
if a.Y > b.Y then
Exchange(a.Y, b.Y);
end;
NormalizeRect(ext);
CheckProportions;
FChart.LogicalExtent := ext;
Handled;