mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-29 00:18:15 +02:00
TAChart: Add DoubleRect utility function, EChartError base exception class.
git-svn-id: trunk@19603 -
This commit is contained in:
parent
468a0e145f
commit
56cc734a27
@ -29,7 +29,7 @@ unit TAChartUtils;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Graphics, Types;
|
Graphics, Types, SysUtils;
|
||||||
|
|
||||||
const
|
const
|
||||||
MaxColor = 15;
|
MaxColor = 15;
|
||||||
@ -38,6 +38,8 @@ const
|
|||||||
clTeal, clNavy, clMaroon, clLime, clOlive, clPurple, clSilver, clAqua);
|
clTeal, clNavy, clMaroon, clLime, clOlive, clPurple, clSilver, clAqua);
|
||||||
|
|
||||||
type
|
type
|
||||||
|
EChartError = class(Exception);
|
||||||
|
|
||||||
TChartCoord = record
|
TChartCoord = record
|
||||||
x, y: Double;
|
x, y: Double;
|
||||||
Color: TColor;
|
Color: TColor;
|
||||||
@ -110,11 +112,13 @@ const
|
|||||||
'%1:.2f%% of %3:g', // smsLabelPercentTotal
|
'%1:.2f%% of %3:g', // smsLabelPercentTotal
|
||||||
'%4:g' // smsXValue
|
'%4:g' // smsXValue
|
||||||
);
|
);
|
||||||
|
EmptyDoubleRect: TDoubleRect = (coords: (0, 0, 0, 0));
|
||||||
|
|
||||||
procedure CalculateIntervals(
|
procedure CalculateIntervals(
|
||||||
AMin, AMax: Double; AxisScale: TAxisScale; out AStart, AStep: Double);
|
AMin, AMax: Double; AxisScale: TAxisScale; out AStart, AStep: Double);
|
||||||
|
|
||||||
function DoublePoint(const ACoord: TChartCoord): TDoublePoint;
|
function DoublePoint(const ACoord: TChartCoord): TDoublePoint; inline;
|
||||||
|
function DoubleRect(AX1, AY1, AX2, AY2: Double): TDoubleRect; inline;
|
||||||
|
|
||||||
procedure Exchange(var A, B: Integer); overload;
|
procedure Exchange(var A, B: Integer); overload;
|
||||||
procedure Exchange(var A, B: Double); overload;
|
procedure Exchange(var A, B: Double); overload;
|
||||||
@ -139,7 +143,7 @@ operator +(const A: TPoint; B: TSize): TPoint;
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, SysUtils, LCLIntf, LCLType;
|
Math, LCLIntf, LCLType;
|
||||||
|
|
||||||
procedure CalculateIntervals(
|
procedure CalculateIntervals(
|
||||||
AMin, AMax: Double; AxisScale: TAxisScale; out AStart, AStep: Double);
|
AMin, AMax: Double; AxisScale: TAxisScale; out AStart, AStep: Double);
|
||||||
@ -216,6 +220,14 @@ begin
|
|||||||
Result.Y := ACoord.y;
|
Result.Y := ACoord.y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function DoubleRect(AX1, AY1, AX2, AY2: Double): TDoubleRect; inline;
|
||||||
|
begin
|
||||||
|
Result.a.X := AX1;
|
||||||
|
Result.a.Y := AY1;
|
||||||
|
Result.b.X := AX2;
|
||||||
|
Result.b.Y := AY2;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure Exchange(var A, B: Integer); overload;
|
procedure Exchange(var A, B: Integer); overload;
|
||||||
var
|
var
|
||||||
t: Integer;
|
t: Integer;
|
||||||
|
@ -33,7 +33,7 @@ uses
|
|||||||
TAGraph, TAChartUtils, TATypes;
|
TAGraph, TAChartUtils, TATypes;
|
||||||
|
|
||||||
type
|
type
|
||||||
BarException = class(Exception);
|
EBarError = class(EChartError);
|
||||||
|
|
||||||
{ TChartSeries }
|
{ TChartSeries }
|
||||||
|
|
||||||
@ -1083,7 +1083,7 @@ end;
|
|||||||
procedure TBarSeries.SetBarWidthPercent(Value: Integer);
|
procedure TBarSeries.SetBarWidthPercent(Value: Integer);
|
||||||
begin
|
begin
|
||||||
if (Value < 1) or (Value > 100) then
|
if (Value < 1) or (Value > 100) then
|
||||||
raise BarException.Create('Wrong BarWidth Percent');
|
raise EBarError.Create('Wrong BarWidth Percent');
|
||||||
FBarWidthPercent := Value;
|
FBarWidthPercent := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user