mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-25 03:19:15 +02:00
TAChart: Move TGenericChartMarks.Shape property to TChartTextElement
git-svn-id: trunk@38578 -
This commit is contained in:
parent
0f977d7469
commit
5417050ae2
@ -39,15 +39,19 @@ type
|
|||||||
property Top default DEF_LABEL_MARGIN_Y;
|
property Top default DEF_LABEL_MARGIN_Y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TChartLabelShape = (clsRectangle, clsEllipse);
|
||||||
|
|
||||||
TChartTextElement = class(TChartElement)
|
TChartTextElement = class(TChartElement)
|
||||||
strict private
|
strict private
|
||||||
FClipped: Boolean;
|
FClipped: Boolean;
|
||||||
FMargins: TChartLabelMargins;
|
FMargins: TChartLabelMargins;
|
||||||
FOverlapPolicy: TChartMarksOverlapPolicy;
|
FOverlapPolicy: TChartMarksOverlapPolicy;
|
||||||
|
FShape: TChartLabelShape;
|
||||||
procedure SetAlignment(AValue: TAlignment);
|
procedure SetAlignment(AValue: TAlignment);
|
||||||
procedure SetClipped(AValue: Boolean);
|
procedure SetClipped(AValue: Boolean);
|
||||||
procedure SetMargins(AValue: TChartLabelMargins);
|
procedure SetMargins(AValue: TChartLabelMargins);
|
||||||
procedure SetOverlapPolicy(AValue: TChartMarksOverlapPolicy);
|
procedure SetOverlapPolicy(AValue: TChartMarksOverlapPolicy);
|
||||||
|
procedure SetShape(AValue: TChartLabelShape);
|
||||||
strict protected
|
strict protected
|
||||||
FAlignment: TAlignment;
|
FAlignment: TAlignment;
|
||||||
procedure ApplyLabelFont(ADrawer: IChartDrawer); virtual;
|
procedure ApplyLabelFont(ADrawer: IChartDrawer); virtual;
|
||||||
@ -71,13 +75,15 @@ type
|
|||||||
ADrawer: IChartDrawer; const ADataPoint, ALabelCenter: TPoint;
|
ADrawer: IChartDrawer; const ADataPoint, ALabelCenter: TPoint;
|
||||||
const AText: String; var APrevLabelPoly: TPointArray);
|
const AText: String; var APrevLabelPoly: TPointArray);
|
||||||
function GetLabelPolygon(
|
function GetLabelPolygon(
|
||||||
ADrawer: IChartDrawer; ASize: TPoint): TPointArray; virtual;
|
ADrawer: IChartDrawer; ASize: TPoint): TPointArray;
|
||||||
function MeasureLabel(ADrawer: IChartDrawer; const AText: String): TSize;
|
function MeasureLabel(ADrawer: IChartDrawer; const AText: String): TSize;
|
||||||
public
|
public
|
||||||
// If false, labels may overlap axises and legend.
|
// If false, labels may overlap axises and legend.
|
||||||
property Clipped: Boolean read FClipped write SetClipped default true;
|
property Clipped: Boolean read FClipped write SetClipped default true;
|
||||||
property OverlapPolicy: TChartMarksOverlapPolicy
|
property OverlapPolicy: TChartMarksOverlapPolicy
|
||||||
read FOverlapPolicy write SetOverlapPolicy default opIgnore;
|
read FOverlapPolicy write SetOverlapPolicy default opIgnore;
|
||||||
|
property Shape: TChartLabelShape
|
||||||
|
read FShape write SetShape default clsRectangle;
|
||||||
published
|
published
|
||||||
property Alignment: TAlignment
|
property Alignment: TAlignment
|
||||||
read FAlignment write SetAlignment;
|
read FAlignment write SetAlignment;
|
||||||
@ -127,7 +133,6 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
TChartMarkAttachment = (maDefault, maEdge, maCenter);
|
TChartMarkAttachment = (maDefault, maEdge, maCenter);
|
||||||
TChartMarkLabelShape = (cmsRectangle, cmsEllipse);
|
|
||||||
|
|
||||||
{ TGenericChartMarks }
|
{ TGenericChartMarks }
|
||||||
|
|
||||||
@ -142,7 +147,6 @@ type
|
|||||||
FArrow: TChartArrow;
|
FArrow: TChartArrow;
|
||||||
FAttachment: TChartMarkAttachment;
|
FAttachment: TChartMarkAttachment;
|
||||||
FFrame: _TFramePen;
|
FFrame: _TFramePen;
|
||||||
FShape: TChartMarkLabelShape;
|
|
||||||
FYIndex: Integer;
|
FYIndex: Integer;
|
||||||
function GetDistanceToCenter: Boolean;
|
function GetDistanceToCenter: Boolean;
|
||||||
procedure SetArrow(AValue: TChartArrow);
|
procedure SetArrow(AValue: TChartArrow);
|
||||||
@ -154,7 +158,6 @@ type
|
|||||||
procedure SetLabelBrush(AValue: _TLabelBrush);
|
procedure SetLabelBrush(AValue: _TLabelBrush);
|
||||||
procedure SetLabelFont(AValue: TFont);
|
procedure SetLabelFont(AValue: TFont);
|
||||||
procedure SetLinkPen(AValue: _TLinkPen);
|
procedure SetLinkPen(AValue: _TLinkPen);
|
||||||
procedure SetShape(AValue: TChartMarkLabelShape);
|
|
||||||
procedure SetStyle(AValue: TSeriesMarksStyle);
|
procedure SetStyle(AValue: TSeriesMarksStyle);
|
||||||
procedure SetYIndex(AValue: Integer);
|
procedure SetYIndex(AValue: Integer);
|
||||||
strict protected
|
strict protected
|
||||||
@ -179,8 +182,6 @@ type
|
|||||||
public
|
public
|
||||||
procedure Assign(ASource: TPersistent); override;
|
procedure Assign(ASource: TPersistent); override;
|
||||||
function CenterOffset(ADrawer: IChartDrawer; const AText: String): TSize;
|
function CenterOffset(ADrawer: IChartDrawer; const AText: String): TSize;
|
||||||
function GetLabelPolygon(
|
|
||||||
ADrawer: IChartDrawer; ASize: TPoint): TPointArray; override;
|
|
||||||
function IsMarkLabelsVisible: Boolean;
|
function IsMarkLabelsVisible: Boolean;
|
||||||
procedure SetAdditionalAngle(AAngle: Double);
|
procedure SetAdditionalAngle(AAngle: Double);
|
||||||
public
|
public
|
||||||
@ -202,8 +203,7 @@ type
|
|||||||
property Clipped;
|
property Clipped;
|
||||||
property Distance: TChartDistance read FDistance write SetDistance;
|
property Distance: TChartDistance read FDistance write SetDistance;
|
||||||
property LabelFont: TFont read FLabelFont write SetLabelFont;
|
property LabelFont: TFont read FLabelFont write SetLabelFont;
|
||||||
property Shape: TChartMarkLabelShape
|
property Shape;
|
||||||
read FShape write SetShape default cmsRectangle;
|
|
||||||
property Visible default true;
|
property Visible default true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -349,8 +349,25 @@ end;
|
|||||||
|
|
||||||
function TChartTextElement.GetLabelPolygon(
|
function TChartTextElement.GetLabelPolygon(
|
||||||
ADrawer: IChartDrawer; ASize: TPoint): TPointArray;
|
ADrawer: IChartDrawer; ASize: TPoint): TPointArray;
|
||||||
|
var
|
||||||
|
e: TEllipse;
|
||||||
|
a: Double;
|
||||||
|
i: Integer;
|
||||||
|
b: TRect;
|
||||||
begin
|
begin
|
||||||
Result := RotateRect(GetBoundingBox(ADrawer, ASize), GetLabelAngle);
|
a := GetLabelAngle;
|
||||||
|
b := GetBoundingBox(ADrawer, ASize);
|
||||||
|
case Shape of
|
||||||
|
clsRectangle:
|
||||||
|
Result := RotateRect(b, a);
|
||||||
|
clsEllipse: begin
|
||||||
|
e.InitBoundingBox(b.Left, b.Top, b.Right, b.Bottom);
|
||||||
|
Result := e.TesselateRadialPie(0, 2 * Pi, 3);
|
||||||
|
SetLength(Result, Length(Result) - 1);
|
||||||
|
for i := 0 to High(Result) do
|
||||||
|
Result[i] := RotatePoint(Result[i], a);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChartTextElement.GetLinkPen: TChartPen;
|
function TChartTextElement.GetLinkPen: TChartPen;
|
||||||
@ -400,6 +417,13 @@ begin
|
|||||||
StyleChanged(Self);
|
StyleChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChartTextElement.SetShape(AValue: TChartLabelShape);
|
||||||
|
begin
|
||||||
|
if FShape = AValue then exit;
|
||||||
|
FShape := AValue;
|
||||||
|
StyleChanged(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
{ TChartTitle }
|
{ TChartTitle }
|
||||||
|
|
||||||
procedure TChartTitle.Assign(ASource: TPersistent);
|
procedure TChartTitle.Assign(ASource: TPersistent);
|
||||||
@ -596,28 +620,6 @@ begin
|
|||||||
Result := LabelFont;
|
Result := LabelFont;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGenericChartMarks.GetLabelPolygon(ADrawer: IChartDrawer;
|
|
||||||
ASize: TPoint): TPointArray;
|
|
||||||
var
|
|
||||||
e: TEllipse;
|
|
||||||
a: Double;
|
|
||||||
i: Integer;
|
|
||||||
begin
|
|
||||||
case Shape of
|
|
||||||
cmsRectangle:
|
|
||||||
Result := RotateRect(GetBoundingBox(ADrawer, ASize), GetLabelAngle);
|
|
||||||
cmsEllipse: begin
|
|
||||||
with GetBoundingBox(ADrawer, ASize) do
|
|
||||||
e.InitBoundingBox(Left, Top, Right, Bottom);
|
|
||||||
Result := e.TesselateRadialPie(0, 2 * Pi, 3);
|
|
||||||
SetLength(Result, Length(Result) - 1);
|
|
||||||
a := GetLabelAngle;
|
|
||||||
for i := 0 to High(Result) do
|
|
||||||
Result[i] := RotatePoint(Result[i], a);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TGenericChartMarks.GetLinkPen: TChartPen;
|
function TGenericChartMarks.GetLinkPen: TChartPen;
|
||||||
begin
|
begin
|
||||||
Result := LinkPen;
|
Result := LinkPen;
|
||||||
@ -701,13 +703,6 @@ begin
|
|||||||
StyleChanged(Self);
|
StyleChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGenericChartMarks.SetShape(AValue: TChartMarkLabelShape);
|
|
||||||
begin
|
|
||||||
if FShape = AValue then exit;
|
|
||||||
FShape := AValue;
|
|
||||||
StyleChanged(Self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TGenericChartMarks.SetStyle(AValue: TSeriesMarksStyle);
|
procedure TGenericChartMarks.SetStyle(AValue: TSeriesMarksStyle);
|
||||||
begin
|
begin
|
||||||
if FStyle = AValue then exit;
|
if FStyle = AValue then exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user