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

View File

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

View File

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

View File

@ -62,6 +62,7 @@ type
procedure Polyline( procedure Polyline(
const APoints: array of TPoint; AStartIndex, ANumPts: Integer); const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
procedure PrepareSimplePen(AColor: TChartColor); procedure PrepareSimplePen(AColor: TChartColor);
procedure PutPixel(AX, AY: Integer; AColor: TChartColor); override;
procedure RadialPie( procedure RadialPie(
AX1, AY1, AX2, AY2: Integer; AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer); AStartAngle16Deg, AAngleLength16Deg: Integer);
@ -241,6 +242,37 @@ begin
FPenWidth := 1; FPenWidth := 1;
end; 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( procedure TFPVectorialDrawer.RadialPie(
AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer); AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer);
var var

View File

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

View File

@ -83,6 +83,7 @@ type
const APoints: array of TPoint; AStartIndex, ANumPts: Integer); const APoints: array of TPoint; AStartIndex, ANumPts: Integer);
procedure PrepareSimplePen(AColor: TChartColor); procedure PrepareSimplePen(AColor: TChartColor);
procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage); override; procedure PutImage(AX, AY: Integer; AImage: TFPCustomImage); override;
procedure PutPixel(AX, AY: Integer; AColor: TChartColor); override;
procedure RadialPie( procedure RadialPie(
AX1, AY1, AX2, AY2: Integer; AX1, AY1, AX2, AY2: Integer;
AStartAngle16Deg, AAngleLength16Deg: Integer); AStartAngle16Deg, AAngleLength16Deg: Integer);
@ -343,6 +344,14 @@ begin
end; end;
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( procedure TSVGDrawer.RadialPie(
AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer); AX1, AY1, AX2, AY2: Integer; AStartAngle16Deg, AAngleLength16Deg: Integer);
var var

View File

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

View File

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