TAChart: Update area demo to show new property "MarkPositionCentered".

git-svn-id: branches/fixes_2_0@60191 -
This commit is contained in:
mattias 2019-01-24 09:47:40 +00:00
parent f9e9f72707
commit 9790b72f61
3 changed files with 48 additions and 13 deletions

View File

@ -7,7 +7,7 @@ object Form1: TForm1
ClientHeight = 440
ClientWidth = 694
OnCreate = FormCreate
LCLVersion = '1.9.0.0'
LCLVersion = '2.1.0.0'
object PageControl1: TPageControl
Left = 4
Height = 432
@ -91,16 +91,16 @@ object Form1: TForm1
Value = 0
end
object BtnNewData: TButton
AnchorSideLeft.Control = CbLabelsAt
AnchorSideLeft.Control = CbCentered
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbUseZeroLevel
AnchorSideTop.Side = asrCenter
Left = 381
Left = 433
Height = 25
Top = 5
Width = 76
AutoSize = True
BorderSpacing.Left = 32
BorderSpacing.Left = 8
Caption = 'New data'
OnClick = BtnNewDataClick
TabOrder = 4
@ -110,7 +110,7 @@ object Form1: TForm1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbStacked
AnchorSideTop.Side = asrCenter
Left = 473
Left = 525
Height = 15
Top = 10
Width = 33
@ -123,7 +123,7 @@ object Form1: TForm1
AnchorSideLeft.Control = EdYCount
AnchorSideTop.Control = CbStacked
AnchorSideTop.Side = asrCenter
Left = 522
Left = 574
Height = 23
Top = 6
Width = 50
@ -166,7 +166,7 @@ object Form1: TForm1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = EdYCount
AnchorSideTop.Side = asrCenter
Left = 473
Left = 525
Height = 15
Top = 37
Width = 41
@ -180,7 +180,7 @@ object Form1: TForm1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = EdCount
AnchorSideTop.Side = asrBottom
Left = 522
Left = 574
Height = 23
Top = 33
Width = 50
@ -226,6 +226,7 @@ object Form1: TForm1
Top = 33
Width = 76
BorderSpacing.Left = 4
Enabled = False
ItemHeight = 15
OnChange = CbLabelsAtChange
TabOrder = 11
@ -244,6 +245,21 @@ object Form1: TForm1
OnChange = CbShowLegendChange
TabOrder = 12
end
object CbCentered: TCheckBox
AnchorSideLeft.Control = CbLabelsAt
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CbShowDataLabels
AnchorSideTop.Side = asrCenter
Left = 357
Height = 19
Top = 35
Width = 68
BorderSpacing.Left = 8
Caption = 'Centered'
Enabled = False
OnChange = CbCenteredChange
TabOrder = 13
end
end
object Chart1: TChart
Left = 0
@ -338,6 +354,7 @@ object Form1: TForm1
Pointer.HorizSize = 5
Pointer.Style = psCircle
Pointer.VertSize = 5
Pointer.Visible = True
ShowPoints = True
Source = ChartSourceLine1
end
@ -355,6 +372,7 @@ object Form1: TForm1
Pointer.HorizSize = 5
Pointer.Style = psCircle
Pointer.VertSize = 5
Pointer.Visible = True
ShowPoints = True
Source = ChartSourceLine2
end

View File

@ -33,6 +33,7 @@ type
CbShowDataLabels: TCheckBox;
CbLabelsAt: TComboBox;
CbShowLegend: TCheckBox;
CbCentered: TCheckBox;
EdYCount: TSpinEdit;
EdZeroLevel: TFloatSpinEdit;
Label1: TLabel;
@ -49,6 +50,7 @@ type
ChartSourceLine2: TUserDefinedChartSource;
procedure BtnNewDataClick(Sender: TObject);
procedure CbBandedChange(Sender: TObject);
procedure CbCenteredChange(Sender: TObject);
procedure CbLabelsAtChange(Sender: TObject);
procedure CbShowDataLabelsChange(Sender: TObject);
procedure CbShowLegendChange(Sender: TObject);
@ -87,7 +89,7 @@ implementation
{$R *.lfm}
uses
Math, TAChartUtils;
Math, TAChartUtils, TATextElements;
type
TData = record
@ -118,6 +120,18 @@ begin
{$IFEND}
end;
procedure TForm1.CbCenteredChange(Sender: TObject);
begin
Chart1AreaSeries1.MarkPositionCentered := CbCentered.Checked;
if CbCentered.Checked then begin
Chart1AreaSeries1.Marks.Distance := 0;
Chart1AreaSeries1.Marks.Attachment := maCenter;
end else begin
Chart1AreaSeries1.Marks.Distance := 20;
Chart1AreaSeries1.Marks.Attachment := maDefault;
end;
end;
procedure TForm1.CbLabelsAtChange(Sender: TObject);
begin
if CbLabelsAt.ItemIndex = 0 then
@ -133,6 +147,8 @@ begin
Chart1AreaSeries1.Marks.Format := '%.2f';
end else
Chart1AreaSeries1.Marks.Style := smsNone;
CbCentered.Enabled := CbShowDataLabels.Checked;
CbLabelsAt.Enabled := CbShowDataLabels.Checked;
end;
procedure TForm1.CbShowLegendChange(Sender: TObject);

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
@ -17,9 +17,10 @@
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
<FormatVersion Value="2"/>
<Modes Count="1">
<Mode0 Name="default"/>
</Modes>
</RunParams>
<RequiredPackages Count="2">
<Item1>