mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 09:59:23 +02:00
TAChart: Initial commit for html tags in titles and labels.
git-svn-id: trunk@55427 -
This commit is contained in:
parent
f06f1ef334
commit
8532170a20
@ -41,6 +41,10 @@ type
|
|||||||
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
function GetBrushColor: TChartColor;
|
function GetBrushColor: TChartColor;
|
||||||
|
function GetFontColor: TFPColor; override;
|
||||||
|
function GetFontName: String; override;
|
||||||
|
function GetFontSize: Integer; override;
|
||||||
|
function GetFontStyle: TChartFontStyles; override;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
procedure LineTo(AX, AY: Integer); override;
|
procedure LineTo(AX, AY: Integer); override;
|
||||||
@ -123,6 +127,34 @@ begin
|
|||||||
Result := FCanvas.Font.AggAngle;
|
Result := FCanvas.Font.AggAngle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TAggPasDrawer.GetFontColor: TFPColor;
|
||||||
|
begin
|
||||||
|
Result.Red := FCanvas.Font.AggColor.r shl 8;
|
||||||
|
Result.Green := FCanvas.Font.AggColor.g shl 8;
|
||||||
|
Result.Blue := FCanvas.Font.AggColor.b shl 8;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TAggPasDrawer.GetFontName: String;
|
||||||
|
begin
|
||||||
|
Result := FCanvas.Font.Name;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TAggPasDrawer.GetFontSize: Integer;
|
||||||
|
begin
|
||||||
|
if FCanvas.Font.AggHeight = 0 then
|
||||||
|
Result := DEFAULT_FONT_SIZE else
|
||||||
|
Result := round(FCanvas.Font.AggHeight * 72 / 96);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TAggPasDrawer.GetFontStyle: TChartFontStyles;
|
||||||
|
begin
|
||||||
|
Result := [];
|
||||||
|
if FCanvas.Font.Bold then Include(Result, cfsBold);
|
||||||
|
if FCanvas.Font.Italic then Include(Result, cfsItalic);
|
||||||
|
if FCanvas.Font.Underline then Include(Result, cfsUnderline);
|
||||||
|
if FCanvas.Font.StrikeThrough then Include(Result, cfsStrikeout);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TAggPasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
procedure TAggPasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
begin
|
begin
|
||||||
FCanvas.Line(AX1, AY1, AX2, AY2);
|
FCanvas.Line(AX1, AY1, AX2, AY2);
|
||||||
|
@ -59,6 +59,7 @@ type
|
|||||||
property LabelBrush;
|
property LabelBrush;
|
||||||
property PositionOnMarks: Boolean
|
property PositionOnMarks: Boolean
|
||||||
read FPositionOnMarks write SetPositionOnMarks default false;
|
read FPositionOnMarks write SetPositionOnMarks default false;
|
||||||
|
property TextFormat;
|
||||||
property Visible default false;
|
property Visible default false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -138,6 +139,7 @@ type
|
|||||||
property Source: TCustomChartSource read FSource write SetSource;
|
property Source: TCustomChartSource read FSource write SetSource;
|
||||||
property Stripes;
|
property Stripes;
|
||||||
property Style default smsValue;
|
property Style default smsValue;
|
||||||
|
property TextFormat;
|
||||||
property YIndex;
|
property YIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
for details about the copyright.
|
for details about the copyright.
|
||||||
"/>
|
"/>
|
||||||
<Version Major="1"/>
|
<Version Major="1"/>
|
||||||
<Files Count="49">
|
<Files Count="50">
|
||||||
<Item1>
|
<Item1>
|
||||||
<Filename Value="tagraph.pas"/>
|
<Filename Value="tagraph.pas"/>
|
||||||
<HasRegisterProc Value="True"/>
|
<HasRegisterProc Value="True"/>
|
||||||
@ -245,6 +245,10 @@
|
|||||||
<HasRegisterProc Value="True"/>
|
<HasRegisterProc Value="True"/>
|
||||||
<UnitName Value="TAChartCombos"/>
|
<UnitName Value="TAChartCombos"/>
|
||||||
</Item49>
|
</Item49>
|
||||||
|
<Item50>
|
||||||
|
<Filename Value="tahtml.pas"/>
|
||||||
|
<UnitName Value="TAHtml"/>
|
||||||
|
</Item50>
|
||||||
</Files>
|
</Files>
|
||||||
<LazDoc Paths="$(LazarusDir)\components\tachart\fpdoc"/>
|
<LazDoc Paths="$(LazarusDir)\components\tachart\fpdoc"/>
|
||||||
<i18n>
|
<i18n>
|
||||||
|
@ -17,7 +17,7 @@ uses
|
|||||||
TAToolEditors, TAMath, TAChartImageList, TAChartTeeChart, TADataTools,
|
TAToolEditors, TAMath, TAChartImageList, TAChartTeeChart, TADataTools,
|
||||||
TAAnimatedSource, TATextElements, TAAxisSource, TASeriesPropEditors,
|
TAAnimatedSource, TATextElements, TAAxisSource, TASeriesPropEditors,
|
||||||
TACustomFuncSeries, TAFitUtils, TAGUIConnector, TADiagram, TADiagramDrawing,
|
TACustomFuncSeries, TAFitUtils, TAGUIConnector, TADiagram, TADiagramDrawing,
|
||||||
TADiagramLayout, TAChartStrConsts, TAChartCombos, LazarusPackageIntf;
|
TADiagramLayout, TAChartStrConsts, TAChartCombos, TAHtml, LazarusPackageIntf;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -43,6 +43,12 @@ type
|
|||||||
// Like TColor, but avoiding dependency on Graphics.
|
// Like TColor, but avoiding dependency on Graphics.
|
||||||
TChartColor = -$7FFFFFFF-1..$7FFFFFFF;
|
TChartColor = -$7FFFFFFF-1..$7FFFFFFF;
|
||||||
|
|
||||||
|
// dto with TFontStyle
|
||||||
|
TChartFontStyle = (cfsBold, cfsItalic, cfsUnderline, cfsStrikeout);
|
||||||
|
TChartFontStyles = set of TChartFontStyle;
|
||||||
|
|
||||||
|
TChartTextFormat = (tfNormal, tfHTML);
|
||||||
|
|
||||||
TDoublePoint = record
|
TDoublePoint = record
|
||||||
X, Y: Double;
|
X, Y: Double;
|
||||||
end;
|
end;
|
||||||
|
@ -44,6 +44,10 @@ type
|
|||||||
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
function GetBrushColor: TChartColor;
|
function GetBrushColor: TChartColor;
|
||||||
|
function GetFontColor: TFPColor; override;
|
||||||
|
function GetFontName: String; override;
|
||||||
|
function GetFontSize: Integer; override;
|
||||||
|
function GetFontStyle: TChartFontStyles; override;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
procedure LineTo(AX, AY: Integer); override;
|
procedure LineTo(AX, AY: Integer); override;
|
||||||
@ -70,7 +74,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
BGRAText, Graphics, TAGeometry;
|
BGRAText, Graphics, Math, TAGeometry;
|
||||||
|
|
||||||
{ TBGRABitmapDrawer }
|
{ TBGRABitmapDrawer }
|
||||||
|
|
||||||
@ -135,6 +139,29 @@ begin
|
|||||||
Result := 0.0;
|
Result := 0.0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBGRABitmapDrawer.GetFontColor: TFPColor;
|
||||||
|
begin
|
||||||
|
Result := TColorToFPColor(Canvas.Font.Color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBGRABitmapDrawer.GetFontName: String;
|
||||||
|
begin
|
||||||
|
Result := Canvas.Font.Name;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBGRABitmapDrawer.GetFontSize: Integer;
|
||||||
|
begin
|
||||||
|
Result := IfThen(Canvas.Font.Height = 0,
|
||||||
|
DEFAULT_FONT_SIZE,
|
||||||
|
round(abs(Canvas.Font.Height) / ScreenInfo.PixelsPerInchY * 72)
|
||||||
|
);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBGRABitmapDrawer.GetFontStyle: TChartFontStyles;
|
||||||
|
begin
|
||||||
|
Result := TChartFontStyles(Canvas.Font.Style);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBGRABitmapDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
procedure TBGRABitmapDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
begin
|
begin
|
||||||
Canvas.MoveTo(AX1, AY1);
|
Canvas.MoveTo(AX1, AY1);
|
||||||
|
@ -35,7 +35,7 @@ type
|
|||||||
strict protected
|
strict protected
|
||||||
FCanvas: TCanvas;
|
FCanvas: TCanvas;
|
||||||
FBuffer: TBitmap;
|
FBuffer: TBitmap;
|
||||||
function GetFontAngle: Double; override;
|
// function GetFontAngle: Double; override;
|
||||||
function SimpleTextExtent(const AText: String): TPoint; override;
|
function SimpleTextExtent(const AText: String): TPoint; override;
|
||||||
procedure SimpleTextOut(AX, AY: Integer; const AText: String); override;
|
procedure SimpleTextOut(AX, AY: Integer; const AText: String); override;
|
||||||
public
|
public
|
||||||
@ -49,6 +49,11 @@ type
|
|||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
function GetBrushColor: TChartColor;
|
function GetBrushColor: TChartColor;
|
||||||
function GetCanvas: TCanvas; virtual;
|
function GetCanvas: TCanvas; virtual;
|
||||||
|
function GetFontAngle: Double; override;
|
||||||
|
function GetFontColor: TFPColor; override;
|
||||||
|
function GetFontName: String; override;
|
||||||
|
function GetFontSize: Integer; override;
|
||||||
|
function GetFontStyle: TChartFontStyles; override;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
procedure LineTo(AX, AY: Integer); override;
|
procedure LineTo(AX, AY: Integer); override;
|
||||||
@ -84,6 +89,7 @@ type
|
|||||||
function CanvasGetFontOrientationFunc(AFont: TFPCustomFont): Integer;
|
function CanvasGetFontOrientationFunc(AFont: TFPCustomFont): Integer;
|
||||||
function ChartColorSysToFPColor(AChartColor: TChartColor): TFPColor;
|
function ChartColorSysToFPColor(AChartColor: TChartColor): TFPColor;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -173,6 +179,32 @@ begin
|
|||||||
Result := OrientToRad(GetCanvas.Font.Orientation);
|
Result := OrientToRad(GetCanvas.Font.Orientation);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCanvasDrawer.GetFontColor: TFPColor;
|
||||||
|
begin
|
||||||
|
Result := TColorToFPColor(GetCanvas.Font.Color);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCanvasDrawer.GetFontName: String;
|
||||||
|
begin
|
||||||
|
Result := GetCanvas.Font.Name;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCanvasDrawer.GetFontSize: Integer;
|
||||||
|
var
|
||||||
|
h: Integer;
|
||||||
|
begin
|
||||||
|
Result := GetCanvas.Font.Size;
|
||||||
|
if Result = 0 then begin
|
||||||
|
h := GetFontData(GetCanvas.Font.Reference.Handle).Height;
|
||||||
|
Result := round(abs(h) * 72 / ScreenInfo.PixelsPerInchY);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCanvasDrawer.GetFontStyle: TChartFontStyles;
|
||||||
|
begin
|
||||||
|
Result := TChartFontStyles(GetCanvas.Font.Style);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCanvasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
procedure TCanvasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
begin
|
begin
|
||||||
GetCanvas.Line(AX1, AY1, AX2, AY2);
|
GetCanvas.Line(AX1, AY1, AX2, AY2);
|
||||||
|
@ -19,7 +19,7 @@ interface
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, FPCanvas, {$IFDEF USE_FTFONT}FTFont,{$ENDIF}
|
Classes, FPCanvas, FPImage, {$IFDEF USE_FTFONT}FTFont,{$ENDIF}
|
||||||
TAChartUtils, TADrawUtils;
|
TAChartUtils, TADrawUtils;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -36,7 +36,6 @@ type
|
|||||||
procedure SetFont(AFont: TFPCustomFont);
|
procedure SetFont(AFont: TFPCustomFont);
|
||||||
procedure SetPen(APen: TFPCustomPen);
|
procedure SetPen(APen: TFPCustomPen);
|
||||||
strict protected
|
strict protected
|
||||||
function GetFontAngle: Double; override;
|
|
||||||
function SimpleTextExtent(const AText: String): TPoint; override;
|
function SimpleTextExtent(const AText: String): TPoint; override;
|
||||||
procedure SimpleTextOut(AX, AY: Integer; const AText: String); override;
|
procedure SimpleTextOut(AX, AY: Integer; const AText: String); override;
|
||||||
public
|
public
|
||||||
@ -50,6 +49,11 @@ type
|
|||||||
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
function GetBrushColor: TChartColor;
|
function GetBrushColor: TChartColor;
|
||||||
|
function GetFontAngle: Double; override;
|
||||||
|
function GetFontColor: TFPColor; override;
|
||||||
|
function GetFontName: String; override;
|
||||||
|
function GetFontSize: Integer; override;
|
||||||
|
function GetFontStyle: TChartFontStyles; override;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
procedure LineTo(AX, AY: Integer); override;
|
procedure LineTo(AX, AY: Integer); override;
|
||||||
@ -160,6 +164,33 @@ begin
|
|||||||
Result := 0.0;
|
Result := 0.0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFPCanvasDrawer.GetFontColor: TFPColor;
|
||||||
|
begin
|
||||||
|
Result := FCanvas.Font.FPColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFPCanvasDrawer.GetFontName: String;
|
||||||
|
begin
|
||||||
|
Result := FCanvas.Font.Name;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFPCanvasDrawer.GetFontSize: Integer;
|
||||||
|
begin
|
||||||
|
if FCanvas.Font.Size = 0 then
|
||||||
|
Result := DEFAULT_FONT_SIZE
|
||||||
|
else
|
||||||
|
Result := FCanvas.Font.Size;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFPCanvasDrawer.GetFontStyle: TChartFontStyles;
|
||||||
|
begin
|
||||||
|
Result := [];
|
||||||
|
if FCanvas.Font.Bold then Include(Result, cfsBold);
|
||||||
|
if FCanvas.Font.Italic then Include(Result, cfsItalic);
|
||||||
|
if FCanvas.Font.Underline then Include(Result, cfsUnderline);
|
||||||
|
if FCanvas.Font.Strikethrough then Include(Result, cfsStrikeout);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFPCanvasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
procedure TFPCanvasDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
begin
|
begin
|
||||||
FCanvas.Line(AX1, AY1, AX2, AY2);
|
FCanvas.Line(AX1, AY1, AX2, AY2);
|
||||||
|
@ -53,6 +53,10 @@ type
|
|||||||
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
function GetBrushColor: TChartColor;
|
function GetBrushColor: TChartColor;
|
||||||
|
function GetFontColor: TFPColor; override;
|
||||||
|
function GetFontName: String; override;
|
||||||
|
function GetFontSize: Integer; override;
|
||||||
|
function GetFontStyle: TChartFontStyles; override;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint); overload;
|
procedure Line(const AP1, AP2: TPoint); overload;
|
||||||
procedure LineTo(AX, AY: Integer); override;
|
procedure LineTo(AX, AY: Integer); override;
|
||||||
@ -177,6 +181,30 @@ begin
|
|||||||
Result := FFont.Orientation;
|
Result := FFont.Orientation;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFPVectorialDrawer.GetFontcolor: TFPColor;
|
||||||
|
begin
|
||||||
|
Result := FFont.Color;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFPVectorialDrawer.GetFontName: String;
|
||||||
|
begin
|
||||||
|
Result := FFont.Name;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFPVectorialDrawer.GetFontSize: Integer;
|
||||||
|
begin
|
||||||
|
Result := IfThen(FFont.Size = 0, DEFAULT_FONT_SIZE, FFont.Size);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFPVectorialDrawer.GetFontStyle: TChartFontStyles;
|
||||||
|
begin
|
||||||
|
Result := [];
|
||||||
|
if FFont.Bold then Include(Result, cfsBold);
|
||||||
|
if FFont.Italic then Include(Result, cfsItalic);
|
||||||
|
if FFont.Underline then Include(Result, cfsUnderline);
|
||||||
|
if FFont.StrikeThrough then Include(Result, cfsStrikeout);
|
||||||
|
end;
|
||||||
|
|
||||||
function TFPVectorialDrawer.InvertY(AY: Integer): Integer;
|
function TFPVectorialDrawer.InvertY(AY: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
with FBoundingBox do
|
with FBoundingBox do
|
||||||
@ -333,7 +361,7 @@ end;
|
|||||||
procedure TFPVectorialDrawer.SetFont(AFont: TFPCustomFont);
|
procedure TFPVectorialDrawer.SetFont(AFont: TFPCustomFont);
|
||||||
begin
|
begin
|
||||||
FFont.Name := AFont.Name;
|
FFont.Name := AFont.Name;
|
||||||
FFont.Size := IfThen(AFont.Size = 0, 10, AFont.Size);
|
FFont.Size := IfThen(AFont.Size = 0, DEFAULT_FONT_SIZE, AFont.Size);
|
||||||
FFont.Color := AFont.FPColor;
|
FFont.Color := AFont.FPColor;
|
||||||
FFont.Orientation := FGetFontOrientationFunc(AFont);
|
FFont.Orientation := FGetFontOrientationFunc(AFont);
|
||||||
FFont.Bold := AFont.Bold;
|
FFont.Bold := AFont.Bold;
|
||||||
|
@ -43,7 +43,7 @@ type
|
|||||||
FPenWidth: Integer;
|
FPenWidth: Integer;
|
||||||
FFontName: String;
|
FFontName: String;
|
||||||
FFontSize: Integer;
|
FFontSize: Integer;
|
||||||
FFontStyle: Integer;
|
FFontStyle: TChartFontStyles;
|
||||||
FFontAngle: Double;
|
FFontAngle: Double;
|
||||||
FPos: TPoint;
|
FPos: TPoint;
|
||||||
procedure ChartGLColor(AColor: TFPColor);
|
procedure ChartGLColor(AColor: TFPColor);
|
||||||
@ -66,6 +66,10 @@ type
|
|||||||
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
function GetBrushColor: TChartColor;
|
function GetBrushColor: TChartColor;
|
||||||
|
function GetFontColor: TFPColor; override;
|
||||||
|
function GetFontName: String; override;
|
||||||
|
function GetFontSize: Integer; override;
|
||||||
|
function GetFontStyle: TChartFontStyles; override;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
procedure LineTo(AX, AY: Integer); override;
|
procedure LineTo(AX, AY: Integer); override;
|
||||||
@ -99,6 +103,7 @@ implementation
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
GL, GLu, FileUtil,
|
GL, GLu, FileUtil,
|
||||||
|
Math,
|
||||||
{$IFDEF CHARTGL_USE_LAZFREETYPE}
|
{$IFDEF CHARTGL_USE_LAZFREETYPE}
|
||||||
LazFileUtils,
|
LazFileUtils,
|
||||||
EasyLazFreeType, LazFreeTypeFPImageDrawer, LazFreeTypeFontCollection,
|
EasyLazFreeType, LazFreeTypeFPImageDrawer, LazFreeTypeFontCollection,
|
||||||
@ -564,6 +569,26 @@ begin
|
|||||||
Result := 0.0;
|
Result := 0.0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TOpenGLDrawer.GetFontColor: TFPColor;
|
||||||
|
begin
|
||||||
|
Result := FFontColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TOpenGLDrawer.GetFontName: String;
|
||||||
|
begin
|
||||||
|
Result := FFontName;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TOpenGLDrawer.GetFontSize: Integer;
|
||||||
|
begin
|
||||||
|
Result := IFThen(FFontSize = 0, DEFAULT_FONT_SIZE, FFontSize);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TOpenGLDrawer.GetFontStyle: TChartFontStyles;
|
||||||
|
begin
|
||||||
|
Result := FFontStyle;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TOpenGLDrawer.InternalPolyline(
|
procedure TOpenGLDrawer.InternalPolyline(
|
||||||
const APoints: array of TPoint; AStartIndex, ANumPts, AMode: Integer);
|
const APoints: array of TPoint; AStartIndex, ANumPts, AMode: Integer);
|
||||||
var
|
var
|
||||||
@ -705,14 +730,13 @@ end;
|
|||||||
procedure TOpenGLDrawer.SetFont(AFont: TFPCustomFont);
|
procedure TOpenGLDrawer.SetFont(AFont: TFPCustomFont);
|
||||||
begin
|
begin
|
||||||
FFontName := AFont.Name;
|
FFontName := AFont.Name;
|
||||||
if Sametext(FFontName, 'default') then FFontName := 'Arial';
|
if SameText(FFontName, 'default') then FFontName := 'Arial';
|
||||||
FFontSize := AFont.Size;
|
FFontSize := IfThen(AFont.Size = 0, DEFAULT_FONT_SIZE, AFont.Size);
|
||||||
if FFontSize = 0 then FFontSize := 10;
|
FFontStyle := [];
|
||||||
FFontStyle := 0;
|
if AFont.Bold then Include(FFontStyle, cfsBold);
|
||||||
if AFont.Bold then inc(FFontStyle, 1);
|
if AFont.Italic then Include(FFontStyle, cfsItalic);
|
||||||
if AFont.Italic then inc(FFontStyle, 2);
|
if AFont.Underline then Include(FFontStyle, cfsUnderline);
|
||||||
if AFont.Underline then inc(FFontStyle, 4);
|
if AFont.Strikethrough then Include(FFontStyle, cfsStrikeout);
|
||||||
if AFont.Strikethrough then inc(FFontStyle, 8);
|
|
||||||
FFontColor := AFont.FPColor;
|
FFontColor := AFont.FPColor;
|
||||||
|
|
||||||
{$IFDEF CHARTGL_USE_LAZFREETYPE}
|
{$IFDEF CHARTGL_USE_LAZFREETYPE}
|
||||||
|
@ -73,6 +73,10 @@ type
|
|||||||
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
function GetBrushColor: TChartColor;
|
function GetBrushColor: TChartColor;
|
||||||
|
function GetFontColor: TFPColor; override;
|
||||||
|
function GetFontName: String; override;
|
||||||
|
function GetFontSize: Integer; override;
|
||||||
|
function GetFontStyle: TChartFontStyles; override;
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
procedure LineTo(AX, AY: Integer); override;
|
procedure LineTo(AX, AY: Integer); override;
|
||||||
@ -253,6 +257,30 @@ begin
|
|||||||
Result := FFont.Orientation;
|
Result := FFont.Orientation;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSVGDrawer.GetFontColor: TFPColor;
|
||||||
|
begin
|
||||||
|
Result := FFont.Color;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSVGDrawer.GetFontName: String;
|
||||||
|
begin
|
||||||
|
Result := FFont.Name;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSVGDrawer.GetFontSize: Integer;
|
||||||
|
begin
|
||||||
|
Result := IfThen(FFont.Size = 0, DEFAULT_FONT_SIZE, FFont.Size);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TSVGDrawer.GetFontStyle: TChartFontStyles;
|
||||||
|
begin
|
||||||
|
Result := [];
|
||||||
|
if FFont.Bold then Include(Result, cfsBold);
|
||||||
|
if FFont.Italic then Include(Result, cfsItalic);
|
||||||
|
if FFont.Underline then Include(Result, cfsUnderline);
|
||||||
|
if FFont.StrikeThrough then Include(Result, cfsStrikeout);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSVGDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
procedure TSVGDrawer.Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
begin
|
begin
|
||||||
WriteFmt(
|
WriteFmt(
|
||||||
@ -422,7 +450,7 @@ procedure TSVGDrawer.SetFont(AFont: TFPCustomFont);
|
|||||||
begin
|
begin
|
||||||
with FFont do begin
|
with FFont do begin
|
||||||
Name := AFont.Name;
|
Name := AFont.Name;
|
||||||
Size := IfThen(AFont.Size=0, 8, AFont.Size);
|
Size := IfThen(AFont.Size=0, DEFAULT_FONT_SIZE, AFont.Size);
|
||||||
|
|
||||||
// ???
|
// ???
|
||||||
if FMonochromeColor <> clTAColor then
|
if FMonochromeColor <> clTAColor then
|
||||||
|
@ -22,8 +22,9 @@ type
|
|||||||
TChartAntialiasingMode = (amDontCare, amOn, amOff);
|
TChartAntialiasingMode = (amDontCare, amOn, amOff);
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
ISimpleTextOut = interface
|
ISimpleTextOut = interface
|
||||||
|
function HtmlTextExtent(const AText: String): TPoint;
|
||||||
|
procedure HtmlTextOut(AX, AY: Integer; const AText: String);
|
||||||
procedure SimpleTextOut(AX, AY: Integer; const AText: String);
|
procedure SimpleTextOut(AX, AY: Integer; const AText: String);
|
||||||
function SimpleTextExtent(const AText: String): TPoint;
|
function SimpleTextExtent(const AText: String): TPoint;
|
||||||
function GetFontAngle: Double;
|
function GetFontAngle: Double;
|
||||||
@ -38,6 +39,7 @@ type
|
|||||||
FSimpleTextOut: ISimpleTextOut;
|
FSimpleTextOut: ISimpleTextOut;
|
||||||
FText1: String;
|
FText1: String;
|
||||||
FText2: TStrings;
|
FText2: TStrings;
|
||||||
|
FTextFormat: TChartTextFormat;
|
||||||
FWidth: Integer;
|
FWidth: Integer;
|
||||||
|
|
||||||
procedure DoTextOutList;
|
procedure DoTextOutList;
|
||||||
@ -51,6 +53,7 @@ type
|
|||||||
function Pos(const APos: TPoint): TChartTextOut;
|
function Pos(const APos: TPoint): TChartTextOut;
|
||||||
function Text(const AText: String): TChartTextOut;
|
function Text(const AText: String): TChartTextOut;
|
||||||
function Text(AText: TStrings): TChartTextOut;
|
function Text(AText: TStrings): TChartTextOut;
|
||||||
|
function TextFormat(AFormat: TChartTextFormat): TChartTextOut;
|
||||||
function Width(AWidth: Integer): TChartTextOut;
|
function Width(AWidth: Integer): TChartTextOut;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -63,6 +66,7 @@ type
|
|||||||
TScaleItems = set of TScaleItem;
|
TScaleItems = set of TScaleItem;
|
||||||
|
|
||||||
IChartDrawer = interface
|
IChartDrawer = interface
|
||||||
|
['{6D8E5591-6788-4D2D-9FE6-596D5157C3C3}']
|
||||||
procedure AddToFontOrientation(ADelta: Integer);
|
procedure AddToFontOrientation(ADelta: Integer);
|
||||||
procedure ClippingStart(const AClipRect: TRect);
|
procedure ClippingStart(const AClipRect: TRect);
|
||||||
procedure ClippingStart;
|
procedure ClippingStart;
|
||||||
@ -74,6 +78,11 @@ type
|
|||||||
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
procedure Ellipse(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
procedure FillRect(AX1, AY1, AX2, AY2: Integer);
|
||||||
function GetBrushColor: TChartColor;
|
function GetBrushColor: TChartColor;
|
||||||
|
function GetFontAngle: Double;
|
||||||
|
function GetFontColor: TFPColor;
|
||||||
|
function GetFontName: String;
|
||||||
|
function GetFontSize: Integer;
|
||||||
|
function GetFontStyle: TChartFontStyles;
|
||||||
procedure SetDoChartColorToFPColorFunc(AValue: TChartColorToFPColorFunc);
|
procedure SetDoChartColorToFPColorFunc(AValue: TChartColorToFPColorFunc);
|
||||||
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
procedure Line(AX1, AY1, AX2, AY2: Integer);
|
||||||
procedure Line(const AP1, AP2: TPoint);
|
procedure Line(const AP1, AP2: TPoint);
|
||||||
@ -108,8 +117,10 @@ type
|
|||||||
procedure SetRightToLeft(AValue: Boolean);
|
procedure SetRightToLeft(AValue: Boolean);
|
||||||
procedure SetTransparency(ATransparency: TChartTransparency);
|
procedure SetTransparency(ATransparency: TChartTransparency);
|
||||||
procedure SetXor(AXor: Boolean);
|
procedure SetXor(AXor: Boolean);
|
||||||
function TextExtent(const AText: String): TPoint;
|
function TextExtent(const AText: String;
|
||||||
function TextExtent(AText: TStrings): TPoint;
|
ATextFormat: TChartTextFormat = tfNormal): TPoint;
|
||||||
|
function TextExtent(AText: TStrings;
|
||||||
|
ATextFormat: TChartTextFormat = tfNormal): TPoint;
|
||||||
function TextOut: TChartTextOut;
|
function TextOut: TChartTextOut;
|
||||||
|
|
||||||
property Brush: TFPCustomBrush write SetBrush;
|
property Brush: TFPCustomBrush write SetBrush;
|
||||||
@ -135,15 +146,22 @@ type
|
|||||||
FScaleItems: TScaleItems;
|
FScaleItems: TScaleItems;
|
||||||
function ColorOrMono(AColor: TChartColor): TChartColor; inline;
|
function ColorOrMono(AColor: TChartColor): TChartColor; inline;
|
||||||
function FPColorOrMono(const AColor: TFPColor): TFPColor; inline;
|
function FPColorOrMono(const AColor: TFPColor): TFPColor; inline;
|
||||||
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;
|
||||||
procedure SimpleTextOut(AX, AY: Integer; const AText: String); virtual; abstract;
|
procedure SimpleTextOut(AX, AY: Integer; const AText: String); virtual; abstract;
|
||||||
|
function HtmlTextExtent(const AText: String): TPoint;
|
||||||
|
procedure HtmlTextOut(AX, AY: Integer; const AText: String);
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
procedure DrawingBegin(const ABoundingBox: TRect); virtual;
|
procedure DrawingBegin(const ABoundingBox: TRect); virtual;
|
||||||
procedure DrawingEnd; virtual;
|
procedure DrawingEnd; virtual;
|
||||||
procedure DrawLineDepth(AX1, AY1, AX2, AY2, ADepth: Integer);
|
procedure DrawLineDepth(AX1, AY1, AX2, AY2, ADepth: Integer);
|
||||||
procedure DrawLineDepth(const AP1, AP2: TPoint; ADepth: Integer);
|
procedure DrawLineDepth(const AP1, AP2: TPoint; ADepth: Integer);
|
||||||
|
function GetFontAngle: Double; virtual; abstract;
|
||||||
|
function GetFontColor: TFPColor; virtual; abstract;
|
||||||
|
function GetFontName: String; virtual; abstract;
|
||||||
|
function GetFontSize: Integer; virtual; abstract;
|
||||||
|
function GetFontStyle: TChartFontStyles; virtual; abstract;
|
||||||
function GetRightToLeft: Boolean;
|
function GetRightToLeft: Boolean;
|
||||||
procedure LineTo(AX, AY: Integer); virtual; abstract;
|
procedure LineTo(AX, AY: Integer); virtual; abstract;
|
||||||
procedure LineTo(const AP: TPoint);
|
procedure LineTo(const AP: TPoint);
|
||||||
@ -161,8 +179,8 @@ type
|
|||||||
procedure SetRightToLeft(AValue: Boolean);
|
procedure SetRightToLeft(AValue: Boolean);
|
||||||
procedure SetTransparency(ATransparency: TChartTransparency);
|
procedure SetTransparency(ATransparency: TChartTransparency);
|
||||||
procedure SetXor(AXor: Boolean);
|
procedure SetXor(AXor: Boolean);
|
||||||
function TextExtent(const AText: String): TPoint;
|
function TextExtent(const AText: String; ATextFormat: TChartTextFormat = tfNormal): TPoint;
|
||||||
function TextExtent(AText: TStrings): TPoint;
|
function TextExtent(AText: TStrings; ATextFormat: TChartTextFormat = tfNormal): TPoint;
|
||||||
function TextOut: TChartTextOut;
|
function TextOut: TChartTextOut;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -173,7 +191,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, TAGeometry;
|
Math, TAGeometry, TAHtml;
|
||||||
|
|
||||||
const
|
const
|
||||||
LINE_INTERVAL = 2;
|
LINE_INTERVAL = 2;
|
||||||
@ -241,13 +259,19 @@ var
|
|||||||
begin
|
begin
|
||||||
a := -FSimpleTextOut.GetFontAngle;
|
a := -FSimpleTextOut.GetFontAngle;
|
||||||
for i := 0 to FText2.Count - 1 do begin
|
for i := 0 to FText2.Count - 1 do begin
|
||||||
lineExtent := FSimpleTextOut.SimpleTextExtent(FText2[i]);
|
case FTextFormat of
|
||||||
|
tfNormal: lineExtent := FSimpleTextOut.SimpleTextExtent(FText2[i]);
|
||||||
|
tfHtml : lineExtent := FSimpleTextOut.HtmlTextExtent(FText2[i]);
|
||||||
|
end;
|
||||||
p := FPos;
|
p := FPos;
|
||||||
case FAlignment of
|
case FAlignment of
|
||||||
taCenter: p += RotatePointX((FWidth - lineExtent.X) div 2, a);
|
taCenter: p += RotatePointX((FWidth - lineExtent.X) div 2, a);
|
||||||
taRightJustify: p += RotatePointX(FWidth - lineExtent.X, a);
|
taRightJustify: p += RotatePointX(FWidth - lineExtent.X, a);
|
||||||
end;
|
end;
|
||||||
FSimpleTextOut.SimpleTextOut(p.X, p.Y, FText2[i]);
|
case FTextFormat of
|
||||||
|
tfNormal: FSimpleTextOut.SimpleTextOut(p.X, p.Y, FText2[i]);
|
||||||
|
tfHtml : FSimpleTextOut.HtmlTextOut(p.X, p.Y, FText2[i]);
|
||||||
|
end;
|
||||||
FPos += RotatePoint(Point(0, lineExtent.Y + LINE_INTERVAL), a);
|
FPos += RotatePoint(Point(0, lineExtent.Y + LINE_INTERVAL), a);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -255,7 +279,10 @@ end;
|
|||||||
procedure TChartTextOut.DoTextOutString;
|
procedure TChartTextOut.DoTextOutString;
|
||||||
begin
|
begin
|
||||||
if System.Pos(LineEnding, FText1) = 0 then begin
|
if System.Pos(LineEnding, FText1) = 0 then begin
|
||||||
FSimpleTextOut.SimpleTextOut(FPos.X, FPos.Y, FText1);
|
case FTextFormat of
|
||||||
|
tfNormal: FSimpleTextOut.SimpleTextOut(FPos.X, FPos.Y, FText1);
|
||||||
|
tfHtml : FSimpleTextOut.HtmlTextOut(FPos.X, FPos.Y, FText1);
|
||||||
|
end;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
FText2 := TStringList.Create;
|
FText2 := TStringList.Create;
|
||||||
@ -291,6 +318,12 @@ begin
|
|||||||
Result := Self;
|
Result := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TChartTextOut.TextFormat(AFormat: TChartTextFormat): TChartTextOut;
|
||||||
|
begin
|
||||||
|
FTextFormat := AFormat;
|
||||||
|
Result := Self;
|
||||||
|
end;
|
||||||
|
|
||||||
function TChartTextOut.Width(AWidth: Integer): TChartTextOut;
|
function TChartTextOut.Width(AWidth: Integer): TChartTextOut;
|
||||||
begin
|
begin
|
||||||
FWidth := AWidth;
|
FWidth := AWidth;
|
||||||
@ -347,6 +380,34 @@ begin
|
|||||||
Result := FRightToLeft;
|
Result := FRightToLeft;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBasicDrawer.HtmlTextExtent(const AText: String): TPoint;
|
||||||
|
var
|
||||||
|
IDrawer: IChartDrawer;
|
||||||
|
begin
|
||||||
|
IDrawer := Self as IChartDrawer;
|
||||||
|
// GetInterface('IChartDrawer', IDrawer);
|
||||||
|
with THtmlAnalyzer.Create(IDrawer) do
|
||||||
|
try
|
||||||
|
Result := TextExtent(AText);
|
||||||
|
finally
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBasicDrawer.HtmlTextOut(AX, AY: Integer; const AText: String);
|
||||||
|
var
|
||||||
|
IDrawer: IChartDrawer;
|
||||||
|
begin
|
||||||
|
IDrawer := Self as IChartDrawer;
|
||||||
|
// GetInterface('IChartDrawer', IDrawer);
|
||||||
|
with THtmlAnalyzer.Create(IDrawer) do
|
||||||
|
try
|
||||||
|
TextOut(AX, AY, AText);
|
||||||
|
finally
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBasicDrawer.LineTo(const AP: TPoint);
|
procedure TBasicDrawer.LineTo(const AP: TPoint);
|
||||||
begin
|
begin
|
||||||
LineTo(AP.X, AP.Y)
|
LineTo(AP.X, AP.Y)
|
||||||
@ -411,31 +472,46 @@ begin
|
|||||||
FXor := AXor;
|
FXor := AXor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBasicDrawer.TextExtent(const AText: String): TPoint;
|
function TBasicDrawer.TextExtent(const AText: String;
|
||||||
|
ATextFormat: TChartTextFormat = tfNormal): TPoint;
|
||||||
var
|
var
|
||||||
sl: TStrings;
|
sl: TStrings;
|
||||||
begin
|
begin
|
||||||
if Pos(LineEnding, AText) = 0 then
|
if Pos(LineEnding, AText) = 0 then
|
||||||
exit(SimpleTextExtent(AText));
|
case ATextFormat of
|
||||||
|
tfNormal: exit(SimpleTextExtent(AText));
|
||||||
|
tfHTML : exit(HtmlTextExtent(AText));
|
||||||
|
end;
|
||||||
|
|
||||||
sl := TStringList.Create;
|
sl := TStringList.Create;
|
||||||
try
|
try
|
||||||
sl.Text := AText;
|
sl.Text := AText;
|
||||||
Result := TextExtent(sl);
|
Result := TextExtent(sl, ATextFormat);
|
||||||
finally
|
finally
|
||||||
sl.Free;
|
sl.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBasicDrawer.TextExtent(AText: TStrings): TPoint;
|
function TBasicDrawer.TextExtent(AText: TStrings;
|
||||||
|
ATextFormat: TChartTextFormat = tfNormal): TPoint;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result := Size(0, -LINE_INTERVAL);
|
Result := Size(0, -LINE_INTERVAL);
|
||||||
for i := 0 to AText.Count - 1 do
|
case ATextFormat of
|
||||||
with SimpleTextExtent(AText[i]) do begin
|
tfNormal:
|
||||||
Result.X := Max(Result.X, X);
|
for i := 0 to AText.Count - 1 do
|
||||||
Result.Y += Y + LINE_INTERVAL;
|
with SimpleTextExtent(AText[i]) do begin
|
||||||
end;
|
Result.X := Max(Result.X, X);
|
||||||
|
Result.Y += Y + LINE_INTERVAL;
|
||||||
|
end;
|
||||||
|
tfHtml:
|
||||||
|
for i := 0 to AText.Count - 1 do
|
||||||
|
with HtmlTextExtent(AText[i]) do begin
|
||||||
|
Result.X := Max(Result.X, X);
|
||||||
|
Result.Y += Y + LINE_INTERVAL;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBasicDrawer.TextOut: TChartTextOut;
|
function TBasicDrawer.TextOut: TChartTextOut;
|
||||||
|
@ -56,6 +56,7 @@ type
|
|||||||
FOnGetShape: TChartGetShapeEvent;
|
FOnGetShape: TChartGetShapeEvent;
|
||||||
FOverlapPolicy: TChartMarksOverlapPolicy;
|
FOverlapPolicy: TChartMarksOverlapPolicy;
|
||||||
FShape: TChartLabelShape;
|
FShape: TChartLabelShape;
|
||||||
|
FTextFormat: TChartTextFormat;
|
||||||
procedure SetAlignment(AValue: TAlignment);
|
procedure SetAlignment(AValue: TAlignment);
|
||||||
procedure SetCalloutAngle(AValue: Cardinal);
|
procedure SetCalloutAngle(AValue: Cardinal);
|
||||||
procedure SetClipped(AValue: Boolean);
|
procedure SetClipped(AValue: Boolean);
|
||||||
@ -64,6 +65,7 @@ type
|
|||||||
procedure SetOverlapPolicy(AValue: TChartMarksOverlapPolicy);
|
procedure SetOverlapPolicy(AValue: TChartMarksOverlapPolicy);
|
||||||
procedure SetRotationCenter(AValue: TChartTextRotationCenter);
|
procedure SetRotationCenter(AValue: TChartTextRotationCenter);
|
||||||
procedure SetShape(AValue: TChartLabelShape);
|
procedure SetShape(AValue: TChartLabelShape);
|
||||||
|
procedure SetTextFormat(AValue: TChartTextFormat);
|
||||||
strict protected
|
strict protected
|
||||||
FAlignment: TAlignment;
|
FAlignment: TAlignment;
|
||||||
FInsideDir: TDoublePoint;
|
FInsideDir: TDoublePoint;
|
||||||
@ -107,6 +109,8 @@ type
|
|||||||
read FOnGetShape write SetOnGetShape;
|
read FOnGetShape write SetOnGetShape;
|
||||||
property Shape: TChartLabelShape
|
property Shape: TChartLabelShape
|
||||||
read FShape write SetShape default clsRectangle;
|
read FShape write SetShape default clsRectangle;
|
||||||
|
property TextFormat: TChartTextFormat
|
||||||
|
read FTextFormat write SetTextFormat default tfNormal;
|
||||||
published
|
published
|
||||||
property Alignment: TAlignment
|
property Alignment: TAlignment
|
||||||
read FAlignment write SetAlignment;
|
read FAlignment write SetAlignment;
|
||||||
@ -157,6 +161,7 @@ type
|
|||||||
property OnGetShape;
|
property OnGetShape;
|
||||||
property Shape;
|
property Shape;
|
||||||
property Text: TStrings read FText write SetText;
|
property Text: TStrings read FText write SetText;
|
||||||
|
property TextFormat;
|
||||||
property Visible default false;
|
property Visible default false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -278,6 +283,7 @@ type
|
|||||||
property OverlapPolicy;
|
property OverlapPolicy;
|
||||||
property RotationCenter;
|
property RotationCenter;
|
||||||
property Style default smsNone;
|
property Style default smsNone;
|
||||||
|
property TextFormat;
|
||||||
property YIndex;
|
property YIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -300,6 +306,7 @@ begin
|
|||||||
Self.FMargins.Assign(FMargins);
|
Self.FMargins.Assign(FMargins);
|
||||||
Self.FOverlapPolicy := FOverlapPolicy;
|
Self.FOverlapPolicy := FOverlapPolicy;
|
||||||
Self.FShape := FShape;
|
Self.FShape := FShape;
|
||||||
|
Self.FTextFormat := FTextFormat;
|
||||||
Self.FInsideDir := FInsideDir;
|
Self.FInsideDir := FInsideDir;
|
||||||
end;
|
end;
|
||||||
inherited Assign(ASource);
|
inherited Assign(ASource);
|
||||||
@ -328,7 +335,7 @@ var
|
|||||||
i, w: Integer;
|
i, w: Integer;
|
||||||
begin
|
begin
|
||||||
ApplyLabelFont(ADrawer);
|
ApplyLabelFont(ADrawer);
|
||||||
ptText := ADrawer.TextExtent(AText);
|
ptText := ADrawer.TextExtent(AText, FTextFormat);
|
||||||
w := ptText.X;
|
w := ptText.X;
|
||||||
labelPoly := GetLabelPolygon(ADrawer, ptText);
|
labelPoly := GetLabelPolygon(ADrawer, ptText);
|
||||||
for i := 0 to High(labelPoly) do
|
for i := 0 to High(labelPoly) do
|
||||||
@ -368,7 +375,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
ptText := RotatePoint(P, GetLabelAngle) + ALabelCenter;
|
ptText := RotatePoint(P, GetLabelAngle) + ALabelCenter;
|
||||||
|
|
||||||
ADrawer.TextOut.Pos(ptText).Alignment(Alignment).Width(w).Text(AText).Done;
|
ADrawer.TextOut.TextFormat(FTextFormat).Pos(ptText).Alignment(Alignment).Width(w).Text(AText).Done;
|
||||||
if not Clipped then
|
if not Clipped then
|
||||||
ADrawer.ClippingStart;
|
ADrawer.ClippingStart;
|
||||||
end;
|
end;
|
||||||
@ -468,7 +475,7 @@ function TChartTextElement.MeasureLabel(
|
|||||||
ADrawer: IChartDrawer; const AText: String): TSize;
|
ADrawer: IChartDrawer; const AText: String): TSize;
|
||||||
begin
|
begin
|
||||||
ApplyLabelFont(ADrawer);
|
ApplyLabelFont(ADrawer);
|
||||||
with GetBoundingBox(ADrawer, ADrawer.TextExtent(AText)) do
|
with GetBoundingBox(ADrawer, ADrawer.TextExtent(AText, FTextFormat)) do
|
||||||
Result := MeasureRotatedRect(Point(Right - Left, Bottom - Top), GetLabelAngle);
|
Result := MeasureRotatedRect(Point(Right - Left, Bottom - Top), GetLabelAngle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -478,7 +485,7 @@ var
|
|||||||
R: TRect;
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
ApplyLabelFont(ADrawer);
|
ApplyLabelFont(ADrawer);
|
||||||
R := Rect(0, 0, 0, ADrawer.TextExtent(AText).y);
|
R := Rect(0, 0, 0, ADrawer.TextExtent(AText, FTextFormat).y);
|
||||||
OffsetRect(R, 0, -(R.Bottom - R.Top) div 2);
|
OffsetRect(R, 0, -(R.Bottom - R.Top) div 2);
|
||||||
if IsMarginRequired then
|
if IsMarginRequired then
|
||||||
Margins.ExpandRectScaled(ADrawer, R);
|
Margins.ExpandRectScaled(ADrawer, R);
|
||||||
@ -546,6 +553,14 @@ begin
|
|||||||
StyleChanged(Self);
|
StyleChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChartTextElement.SetTextFormat(AValue: TChartTextFormat);
|
||||||
|
begin
|
||||||
|
if FTextFormat = AValue then exit;
|
||||||
|
FTextFormat := AValue;
|
||||||
|
StyleChanged(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TChartTitle }
|
{ TChartTitle }
|
||||||
|
|
||||||
procedure TChartTitle.Assign(ASource: TPersistent);
|
procedure TChartTitle.Assign(ASource: TPersistent);
|
||||||
|
Loading…
Reference in New Issue
Block a user