mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 09:38:12 +02:00
TAChart: Add TChartTitle.Margin property. Update demo.
git-svn-id: trunk@28775 -
This commit is contained in:
parent
5e5be1fbb4
commit
677bf459b2
@ -39,6 +39,7 @@ object Form1: TForm1
|
||||
Title.Font.Color = clBlue
|
||||
Title.Font.Height = -11
|
||||
Title.Font.Name = 'MS Sans Serif'
|
||||
Title.Margin = 8
|
||||
Title.Text.Strings = (
|
||||
'Centered Chart Title'
|
||||
)
|
||||
@ -46,17 +47,17 @@ object Form1: TForm1
|
||||
Align = alClient
|
||||
ParentColor = False
|
||||
object Chart1LineHor: TConstantLine
|
||||
Legend.Visible = False
|
||||
Pen.Style = psDash
|
||||
Position = 0
|
||||
SeriesColor = clBlack
|
||||
ShowInLegend = False
|
||||
end
|
||||
object Chart1LineVert: TConstantLine
|
||||
Legend.Visible = False
|
||||
LineStyle = lsVertical
|
||||
Pen.Style = psDash
|
||||
Position = 0
|
||||
SeriesColor = clBlack
|
||||
ShowInLegend = False
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
|
@ -612,7 +612,7 @@ begin
|
||||
ACanvas.TextOut(sz.cx, FClipRect.Top, Text[i]);
|
||||
FClipRect.Top += sz.cy;
|
||||
end;
|
||||
FClipRect.Top += 4;
|
||||
FClipRect.Top += Margin;
|
||||
end;
|
||||
with FFoot do
|
||||
if Visible and (Text.Count > 0) then begin
|
||||
@ -623,7 +623,7 @@ begin
|
||||
FClipRect.Bottom -= sz.cy;
|
||||
ACanvas.TextOut(sz.cx, FClipRect.Bottom, Text[i]);
|
||||
end;
|
||||
FClipRect.Bottom -= 4;
|
||||
FClipRect.Bottom -= Margin;
|
||||
end;
|
||||
finally
|
||||
pbf.Free;
|
||||
|
@ -81,18 +81,22 @@ type
|
||||
property Visible: Boolean read FVisible write SetVisible;
|
||||
end;
|
||||
|
||||
{ TChartTitle }
|
||||
|
||||
TChartTitle = class(TChartElement)
|
||||
private
|
||||
FAlignment: TAlignment;
|
||||
FBrush: TBrush;
|
||||
FFont: TFont;
|
||||
FFrame: TChartPen;
|
||||
FMargin: TChartDistance;
|
||||
FText: TStrings;
|
||||
|
||||
procedure SetAlignment(AValue: TAlignment);
|
||||
procedure SetBrush(AValue: TBrush);
|
||||
procedure SetFont(AValue: TFont);
|
||||
procedure SetFrame(AValue: TChartPen);
|
||||
procedure SetMargin(AValue: TChartDistance);
|
||||
procedure SetText(AValue: TStrings);
|
||||
public
|
||||
constructor Create(AOwner: TCustomChart);
|
||||
@ -105,6 +109,8 @@ type
|
||||
property Brush: TBrush read FBrush write SetBrush;
|
||||
property Font: TFont read FFont write SetFont;
|
||||
property Frame: TChartPen read FFrame write SetFrame;
|
||||
property Margin: TChartDistance
|
||||
read FMargin write SetMargin default DEF_MARGIN;
|
||||
property Text: TStrings read FText write SetText;
|
||||
property Visible default false;
|
||||
end;
|
||||
@ -394,6 +400,7 @@ begin
|
||||
InitHelper(FFont, TFont);
|
||||
FFont.Color := clBlue;
|
||||
InitHelper(FFrame, TChartPen);
|
||||
FMargin := DEF_MARGIN;
|
||||
FText := TStringList.Create;
|
||||
end;
|
||||
|
||||
@ -432,6 +439,13 @@ begin
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChartTitle.SetMargin(AValue: TChartDistance);
|
||||
begin
|
||||
if FMargin = AValue then exit;
|
||||
FMargin := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChartTitle.SetText(AValue: TStrings);
|
||||
begin
|
||||
FText.Assign(AValue);
|
||||
|
Loading…
Reference in New Issue
Block a user