TAChart: Add new series pointer style psPoint.

git-svn-id: trunk@49881 -
This commit is contained in:
wp 2015-09-27 19:36:31 +00:00
parent 6875e2e79c
commit 3b03f92c99
8 changed files with 81 additions and 3 deletions

View File

@ -54,6 +54,7 @@ type
const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
procedure PrepareSimplePen(AColor: TChartColor);
procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage); override;
procedure PutPixel(AX, AY: Integer; AColor: TChartColor); override;
procedure RadialPie(
AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer);
@ -190,6 +191,11 @@ begin
Canvas.Colors[AX + x, AY + y] := AImage[x, y];
end;
procedure TBGRABitmapDrawer.PutPixel(AX, AY: Integer; AColor: TChartColor);
begin
Canvas.Pixels[AX, AY] := AColor;
end;
procedure TBGRABitmapDrawer.RadialPie(
AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer);
begin

View File

@ -59,6 +59,7 @@ type
const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
procedure PrepareSimplePen(AColor: TChartColor);
procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage); override;
procedure PutPixel(AX, AY: Integer; AColor: TChartColor); override;
procedure RadialPie(
AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer);
@ -240,6 +241,11 @@ begin
end;
end;
procedure TCanvasDrawer.PutPixel(AX, AY: Integer; AColor: TChartColor);
begin
GetCanvas.Pixels[AX, AY] := AColor;
end;
procedure TCanvasDrawer.RadialPie(
AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer);

View File

@ -59,6 +59,7 @@ type
procedure Polyline(
const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
procedure PrepareSimplePen(AColor: TChartColor);
procedure PutPixel(AX, AY: Integer; AColor: TChartColor);
procedure RadialPie(
AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer);
@ -203,6 +204,11 @@ begin
FCanvas.Pen.Style := psSolid;
end;
procedure TFPCanvasDrawer.PutPixel(AX, AY: Integer; AColor: TChartColor);
begin
FCanvas.Colors[AX, AY] := FChartColorToFPColorFunc(AColor);
end;
procedure TFPCanvasDrawer.RadialPie(
AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer);
var

View File

@ -62,6 +62,7 @@ type
procedure Polyline(
const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
procedure PrepareSimplePen(AColor: TChartColor);
procedure PutPixel(AX, AY: Integer; AColor: TChartColor); override;
procedure RadialPie(
AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer);
@ -241,6 +242,37 @@ begin
FPenWidth := 1;
end;
procedure TFPVectorialDrawer.PutPixel(AX, AY: Integer; AColor: TChartColor);
const
d = 0.2;
var
pencol: TFPColor;
penSty: TFPPenStyle;
brushCol: TFPColor;
brushSty: TFPBrushStyle;
begin
penCol := FPenColor;
penSty := FPenStyle;
brushCol := FBrushColor;
brushSty := FBrushStyle;
SetPenParams(psSolid, AColor);
SetBrushParams(bsSolid, AColor);
AY := InvertY(AY);
FCanvas.StartPath;
FCanvas.AddMoveToPath(AX-d, AY-d);
FCanvas.AddLineToPath(AX-d, AY+d);
FCanvas.AddLineTopath(AX+d, AY+d);
FCanvas.AddLineToPath(AX+d, AY-d);
FCanvas.AddLineToPath(AX-d, AY-d);
ApplyBrush;
ApplyPen;
FCanvas.EndPath;
FPenColor := penCol;
FPenStyle := penSty;
FBrushColor := brushCol;
FBrushStyle := brushSty;
end;
procedure TFPVectorialDrawer.RadialPie(
AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer);
var

View File

@ -215,6 +215,14 @@ begin
FPenStyle := psSolid;
end;
procedure TOpenGLDrawer.PutPixel(AX, AY: Integer; AColor: TChartColor);
begin
ChartGLColor(FChartColorToFPColorFunc(AColor));
glBegin(GL_POINTS);
glVertex2i(AX, AY);
glEnd;
end;
procedure TOpenGLDrawer.RadialPie(
AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer);
var

View File

@ -83,6 +83,7 @@ type
const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
procedure PrepareSimplePen(AColor: TChartColor);
procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage); override;
procedure PutPixel(AX, AY: Integer; AColor: TChartColor); override;
procedure RadialPie(
AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer);
@ -343,6 +344,14 @@ begin
end;
end;
procedure TSVGDrawer.PutPixel(AX, AY: Integer; AColor: TChartColor);
var
stroke: String;
begin
stroke := 'stroke:'+ColorToHex(FChartColorToFPColorFunc(ColorOrMono(AColor))) + ';stroke-width:1;';
WriteFmt(RECT_FMT, [AX, AY, 1, 1, stroke]);
end;
procedure TSVGDrawer.RadialPie(
AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer);
var

View File

@ -84,6 +84,7 @@ type
const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
procedure PrepareSimplePen(AColor: TChartColor);
procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage);
procedure PutPixel(AX, AY: Integer; AColor: TChartColor);
procedure RadialPie(
AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer);
@ -146,6 +147,7 @@ type
procedure Polygon(
const APoints: array of TPoint; AStartIndex, ANumPts: Integer); virtual; abstract;
procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage); virtual;
procedure PutPixel(AX, AY: Integer; AColor: TChartColor); virtual;
function Scale(ADistance: Integer): Integer; virtual;
procedure SetAntialiasingMode(AValue: TChartAntialiasingMode);
procedure SetDoChartColorToFPColorFunc(AValue: TChartColorToFPColorFunc);
@ -356,6 +358,12 @@ begin
Unused(AImage);
end;
procedure TBasicDrawer.PutPixel(AX, AY: Integer; AColor: TChartColor);
begin
Unused(AX, AY);
Unused(AColor);
end;
function TBasicDrawer.Scale(ADistance: Integer): Integer;
begin
Result := ADistance;

View File

@ -93,7 +93,7 @@ type
TSeriesPointerStyle = (
psNone, psRectangle, psCircle, psCross, psDiagCross, psStar,
psLowBracket, psHighBracket, psLeftBracket, psRightBracket, psDiamond,
psTriangle, psLeftTriangle, psRightTriangle, psVertBar, psHorBar);
psTriangle, psLeftTriangle, psRightTriangle, psVertBar, psHorBar, psPoint);
{ TSeriesPointer }
@ -428,10 +428,10 @@ const
DRAW_STRINGS: array [TSeriesPointerStyle] of String = (
// psNone, psRectangle, psCircle, psCross, psDiagCross, psStar,
// psLowBracket, psHighBracket, psLeftBracket, psRightBracket, psDiamond,
// psTriangle, psLeftTriangle, psRightTriangle, psVertBar, psHorBar
// psTriangle, psLeftTriangle, psRightTriangle, psVertBar, psHorBar, psPoint
'', '17931', '', '28 46', '19 73', '28 46 19 73',
'41236', '47896', '87412', '89632', '84268',
'183', '842', '862', '82', '46');
'183', '842', '862', '82', '46', '');
begin
ADrawer.Brush := Brush;
if (ocBrush in OverrideColor) and (AColor <> clTAColor) then
@ -440,6 +440,9 @@ begin
if (ocPen in OverrideColor) and (AColor <> clTAColor) then
ADrawer.SetPenParams(Pen.Style, AColor);
if Style = psPoint then
ADrawer.PutPixel(ACenter.X, ACenter.Y, Pen.Color)
else
if Style = psCircle then
ADrawer.Ellipse(
ACenter.X - ASize.X, ACenter.Y - ASize.Y,