TAChart: Fix bugs in processing of empty extents.

git-svn-id: trunk@20137 -
This commit is contained in:
ask 2009-05-23 04:13:01 +00:00
parent d8bc38d03f
commit 1421f1836b
2 changed files with 12 additions and 6 deletions

View File

@ -1324,11 +1324,17 @@ procedure TChart.UpdateExtent;
if AUseMax then AHi := AMax;
case Ord(ALo = Infinity) * 2 + Ord(AHi = NegInfinity) of
0: begin // Both high and low boundary defined
if ALo > AHi then Exchange(ALo, AHi);
// Expand view slightly to avoid puttind data points on the chart edge.
ext := ExpandPercentage * PERCENT * Max(AHi - ALo, 1);
ALo -= ext;
AHi += ext;
if ALo = AHi then begin
ALo -= DEFAULT_WIDTH / 2;
AHi += DEFAULT_WIDTH / 2;
end
else begin
if ALo > AHi then Exchange(ALo, AHi);
// Expand view slightly to avoid data points on the chart edge.
ext := ExpandPercentage * PERCENT * Max(AHi - ALo, 1);
ALo -= ext;
AHi += ext;
end;
end;
1: AHi := ALo + DEFAULT_WIDTH;
2: ALo := AHi - DEFAULT_WIDTH;

View File

@ -1115,7 +1115,7 @@ begin
Result.b.Y := Max(Result.b.Y, 0);
// The 0.6 is a hack to allow the bars to have some space apart
Result.a.X -= 0.6;
Result.a.X += 0.6;
Result.b.X += 0.6;
end;
function TBarSeries.GetSeriesColor: TColor;