TAChart: Extract TChartRange.Intersect helper procedure

git-svn-id: trunk@32801 -
This commit is contained in:
ask 2011-10-10 13:34:55 +00:00
parent 82df2f14a7
commit 274955e748
2 changed files with 10 additions and 6 deletions

View File

@ -540,12 +540,7 @@ begin
FValueMin := GetTransform.GraphToAxis(FValueMin);
FValueMax := GetTransform.GraphToAxis(FValueMax);
EnsureOrder(FValueMin, FValueMax);
with Marks.Range do begin
if UseMin then
FValueMin := Math.Max(Min, FValueMin);
if UseMax then
FValueMax := Math.Min(Max, FValueMax);
end;
Marks.Range.Intersect(FValueMin, FValueMax);
d := MakeValuesInRangeParams(FValueMin, FValueMax);
FValueMin := GetTransform.AxisToGraph(FValueMin);
FValueMax := GetTransform.AxisToGraph(FValueMax);

View File

@ -320,6 +320,7 @@ type
public
procedure Assign(ASource: TPersistent); override;
procedure CheckBoundsOrder;
procedure Intersect(var AMin, AMax: Double);
published
property Max: Double index 2 read GetBounds write SetBounds stored IsBoundsStored;
property Min: Double index 1 read GetBounds write SetBounds stored IsBoundsStored;
@ -1064,6 +1065,14 @@ begin
Result := FUseBounds[AIndex];
end;
procedure TChartRange.Intersect(var AMin, AMax: Double);
begin
if UseMin and (Min > AMin) then
AMin := Min;
if UseMax and (Max < AMax)then
AMax := Max;
end;
function TChartRange.IsBoundsStored(AIndex: Integer): Boolean;
begin
Result := FBounds[AIndex] <> 0;