mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-14 16:12:41 +02:00
TAChart: Extract TBasicPointSeries.GetXRange function
git-svn-id: trunk@27117 -
This commit is contained in:
parent
e32deb25d6
commit
db61d236a5
@ -166,6 +166,7 @@ type
|
||||
|
||||
procedure DrawLabels(ACanvas: TCanvas);
|
||||
function GetLabelDirection(AIndex: Integer): TLabelDirection; virtual;
|
||||
function GetXRange(AX: Double; AIndex: Integer): Double;
|
||||
procedure PrepareGraphPoints(
|
||||
const AExtent: TDoubleRect; AFilterByExtent: Boolean);
|
||||
procedure UpdateMargins(ACanvas: TCanvas; var AMargins: TRect); override;
|
||||
@ -663,6 +664,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBasicPointSeries.GetXRange(AX: Double; AIndex: Integer): Double;
|
||||
begin
|
||||
case CASE_OF_TWO[AIndex > 0, AIndex < Count - 1] of
|
||||
cotNone: Result := 1.0;
|
||||
cotFirst: Result := Abs(AX - GetGraphPointX(AIndex - 1));
|
||||
cotSecond: Result := Abs(AX - GetGraphPointX(AIndex + 1));
|
||||
cotBoth: Result := Min(
|
||||
Abs(AX - GetGraphPointX(AIndex - 1)),
|
||||
Abs(AX - GetGraphPointX(AIndex + 1)));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBasicPointSeries.MovePoint(
|
||||
var AIndex: Integer; const ANewPos: TPoint);
|
||||
var
|
||||
|
@ -651,15 +651,7 @@ end;
|
||||
|
||||
function TBarSeries.CalcBarWidth(AX: Double; AIndex: Integer): Double;
|
||||
begin
|
||||
case CASE_OF_TWO[AIndex > 0, AIndex < Count - 1] of
|
||||
cotNone: Result := 1.0;
|
||||
cotFirst: Result := Abs(AX - GetGraphPointX(AIndex - 1));
|
||||
cotSecond: Result := Abs(AX - GetGraphPointX(AIndex + 1));
|
||||
cotBoth: Result := Min(
|
||||
Abs(AX - GetGraphPointX(AIndex - 1)),
|
||||
Abs(AX - GetGraphPointX(AIndex + 1)));
|
||||
end;
|
||||
Result *= FBarWidthPercent * PERCENT / 2;
|
||||
Result := GetXRange(AX, AIndex) * FBarWidthPercent * PERCENT / 2;
|
||||
end;
|
||||
|
||||
constructor TBarSeries.Create(AOwner: TComponent);
|
||||
|
Loading…
Reference in New Issue
Block a user