mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 10:19:16 +02:00
TAChart: Rename TFPCanvasDrawer -> TBasicDrawer, move Colors constant to the location of usage
git-svn-id: trunk@29954 -
This commit is contained in:
parent
a7816a6197
commit
9487b41cc5
@ -26,7 +26,7 @@ type
|
|||||||
|
|
||||||
{ TAggPasDrawer }
|
{ TAggPasDrawer }
|
||||||
|
|
||||||
TAggPasDrawer = class(TFPCanvasDrawer, IChartDrawer, ISimpleTextOut)
|
TAggPasDrawer = class(TBasicDrawer, IChartDrawer, ISimpleTextOut)
|
||||||
strict private
|
strict private
|
||||||
FCanvas: TAggLCLCanvas;
|
FCanvas: TAggLCLCanvas;
|
||||||
procedure SetBrush(ABrush: TFPCustomBrush);
|
procedure SetBrush(ABrush: TFPCustomBrush);
|
||||||
|
@ -27,7 +27,7 @@ type
|
|||||||
|
|
||||||
{ TOpenGLDrawer }
|
{ TOpenGLDrawer }
|
||||||
|
|
||||||
TOpenGLDrawer = class(TFPCanvasDrawer, IChartDrawer)
|
TOpenGLDrawer = class(TBasicDrawer, IChartDrawer)
|
||||||
strict private
|
strict private
|
||||||
FBrushColor: TFPColor;
|
FBrushColor: TFPColor;
|
||||||
FContext: TOpenGLControl;
|
FContext: TOpenGLControl;
|
||||||
|
@ -26,11 +26,6 @@ uses
|
|||||||
type
|
type
|
||||||
TChartColor = -$7FFFFFFF-1..$7FFFFFFF;
|
TChartColor = -$7FFFFFFF-1..$7FFFFFFF;
|
||||||
|
|
||||||
const
|
|
||||||
Colors: array [1..15] of TColor = (
|
|
||||||
clRed, clGreen, clYellow, clBlue, clWhite, clGray, clFuchsia,
|
|
||||||
clTeal, clNavy, clMaroon, clLime, clOlive, clPurple, clSilver, clAqua);
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
ISimpleTextOut = interface
|
ISimpleTextOut = interface
|
||||||
@ -117,9 +112,9 @@ type
|
|||||||
property Pen: TFPCustomPen write SetPen;
|
property Pen: TFPCustomPen write SetPen;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFPCanvasDrawer }
|
{ TBasicDrawer }
|
||||||
|
|
||||||
TFPCanvasDrawer = class(TInterfacedObject, ISimpleTextOut)
|
TBasicDrawer = class(TInterfacedObject, ISimpleTextOut)
|
||||||
strict protected
|
strict protected
|
||||||
function GetFontAngle: Double; virtual; abstract;
|
function GetFontAngle: Double; virtual; abstract;
|
||||||
function SimpleTextExtent(const AText: String): TPoint; virtual; abstract;
|
function SimpleTextExtent(const AText: String): TPoint; virtual; abstract;
|
||||||
@ -143,7 +138,7 @@ type
|
|||||||
{ TCanvasDrawer }
|
{ TCanvasDrawer }
|
||||||
|
|
||||||
TCanvasDrawer = class(
|
TCanvasDrawer = class(
|
||||||
TFPCanvasDrawer, IChartDrawer, IChartTCanvasDrawer)
|
TBasicDrawer, IChartDrawer, IChartTCanvasDrawer)
|
||||||
private
|
private
|
||||||
FCanvas: TCanvas;
|
FCanvas: TCanvas;
|
||||||
procedure SetBrush(ABrush: TFPCustomBrush);
|
procedure SetBrush(ABrush: TFPCustomBrush);
|
||||||
@ -292,14 +287,14 @@ begin
|
|||||||
Result := Self;
|
Result := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFPCanvasDrawer }
|
{ TBasicDrawer }
|
||||||
|
|
||||||
procedure TFPCanvasDrawer.DrawLineDepth(AX1, AY1, AX2, AY2, ADepth: Integer);
|
procedure TBasicDrawer.DrawLineDepth(AX1, AY1, AX2, AY2, ADepth: Integer);
|
||||||
begin
|
begin
|
||||||
DrawLineDepth(Point(AX1, AY1), Point(AX2, AY2), ADepth);
|
DrawLineDepth(Point(AX1, AY1), Point(AX2, AY2), ADepth);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCanvasDrawer.DrawLineDepth(const AP1, AP2: TPoint; ADepth: Integer);
|
procedure TBasicDrawer.DrawLineDepth(const AP1, AP2: TPoint; ADepth: Integer);
|
||||||
var
|
var
|
||||||
d: TPoint;
|
d: TPoint;
|
||||||
begin
|
begin
|
||||||
@ -307,22 +302,22 @@ begin
|
|||||||
Polygon([AP1, AP1 + d, AP2 + d, AP2]);
|
Polygon([AP1, AP1 + d, AP2 + d, AP2]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCanvasDrawer.LineTo(const AP: TPoint);
|
procedure TBasicDrawer.LineTo(const AP: TPoint);
|
||||||
begin
|
begin
|
||||||
LineTo(AP.X, AP.Y)
|
LineTo(AP.X, AP.Y)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPCanvasDrawer.MoveTo(const AP: TPoint);
|
procedure TBasicDrawer.MoveTo(const AP: TPoint);
|
||||||
begin
|
begin
|
||||||
MoveTo(AP.X, AP.Y)
|
MoveTo(AP.X, AP.Y)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFPCanvasDrawer.Scale(ADistance: Integer): Integer;
|
function TBasicDrawer.Scale(ADistance: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
Result := ADistance;
|
Result := ADistance;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFPCanvasDrawer.TextExtent(const AText: String): TPoint;
|
function TBasicDrawer.TextExtent(const AText: String): TPoint;
|
||||||
var
|
var
|
||||||
sl: TStrings;
|
sl: TStrings;
|
||||||
begin
|
begin
|
||||||
@ -337,7 +332,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFPCanvasDrawer.TextExtent(AText: TStrings): TPoint;
|
function TBasicDrawer.TextExtent(AText: TStrings): TPoint;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
@ -349,7 +344,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFPCanvasDrawer.TextOut: TChartTextOut;
|
function TBasicDrawer.TextOut: TChartTextOut;
|
||||||
begin
|
begin
|
||||||
Result := TChartTextOut.Create(Self);
|
Result := TChartTextOut.Create(Self);
|
||||||
end;
|
end;
|
||||||
|
@ -269,9 +269,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomPieSeries.SliceColor(AIndex: Integer): TColor;
|
function TCustomPieSeries.SliceColor(AIndex: Integer): TColor;
|
||||||
|
const
|
||||||
|
SLICE_COLORS: array [1..15] of TColor = (
|
||||||
|
clRed, clGreen, clYellow, clBlue, clWhite, clGray, clFuchsia,
|
||||||
|
clTeal, clNavy, clMaroon, clLime, clOlive, clPurple, clSilver, clAqua);
|
||||||
begin
|
begin
|
||||||
Result :=
|
Result :=
|
||||||
ColorOrDefault(Source[AIndex]^.Color, Colors[AIndex mod High(Colors) + 1]);
|
ColorOrDefault(
|
||||||
|
Source[AIndex]^.Color, SLICE_COLORS[AIndex mod High(SLICE_COLORS) + 1]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomPieSeries.TryRadius(ADrawer: IChartDrawer): TRect;
|
function TCustomPieSeries.TryRadius(ADrawer: IChartDrawer): TRect;
|
||||||
|
Loading…
Reference in New Issue
Block a user