TAChart: Layout of basic demo with anchors, some fixes.

git-svn-id: trunk@55552 -
This commit is contained in:
wp 2017-07-20 22:43:47 +00:00
parent 7a7b03235d
commit 1c2074a32a
3 changed files with 220 additions and 129 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="10"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags> <Flags>
@ -11,11 +11,11 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<Title Value="TChart basic demo"/> <Title Value="TChart basic demo"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/>
</General> </General>
<VersionInfo> <VersionInfo>
<Language Value="0403"/> <Language Value="0403"/>
<CharSet Value="04E2"/> <CharSet Value="04E2"/>
<StringTable ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
@ -50,7 +50,6 @@
<Unit0> <Unit0>
<Filename Value="demo.lpr"/> <Filename Value="demo.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="demo"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="unit1.pas"/> <Filename Value="unit1.pas"/>
@ -58,7 +57,6 @@
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="unit1"/>
</Unit1> </Unit1>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
@ -77,6 +75,7 @@
<Linking> <Linking>
<Debugging> <Debugging>
<DebugInfoType Value="dsStabs"/> <DebugInfoType Value="dsStabs"/>
<UseExternalDbgSyms Value="True"/>
</Debugging> </Debugging>
<LinkSmart Value="True"/> <LinkSmart Value="True"/>
<Options> <Options>
@ -87,10 +86,6 @@
</Linking> </Linking>
<Other> <Other>
<WriteFPCLogo Value="False"/> <WriteFPCLogo Value="False"/>
<CompilerMessages>
<UseMsgFile Value="True"/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other> </Other>
</CompilerOptions> </CompilerOptions>
</CONFIG> </CONFIG>

View File

@ -10,6 +10,8 @@ uses
Forms Forms
{ add your units here }, unit1, TAChartLazarusPkg; { add your units here }, unit1, TAChartLazarusPkg;
{$R *.res}
begin begin
Application.Title := 'TChart basic demo'; Application.Title := 'TChart basic demo';
Application.Initialize; Application.Initialize;

View File

@ -2,36 +2,34 @@ object Form1: TForm1
Left = 341 Left = 341
Height = 494 Height = 494
Top = 225 Top = 225
Width = 585 Width = 610
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 494 ClientHeight = 494
ClientWidth = 585 ClientWidth = 610
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.1' LCLVersion = '1.9.0.0'
object Chart1: TChart object Chart1: TChart
Left = 0 Left = 0
Height = 392 Height = 374
Top = 0 Top = 0
Width = 585 Width = 610
AntialiasingMode = amOn AntialiasingMode = amOn
AxisList = < AxisList = <
item item
Grid.Color = clGray Grid.Color = clGray
Minors = <> Minors = <>
Title.LabelFont.Height = -11 Title.LabelFont.Orientation = 900
Title.LabelFont.Name = 'MS Sans Serif' Title.Visible = True
end end
item item
Grid.Color = clGray Grid.Color = clGray
Alignment = calBottom Alignment = calBottom
Minors = <> Minors = <>
Title.LabelFont.Height = -11 Title.Visible = True
Title.LabelFont.Name = 'MS Sans Serif'
end> end>
Foot.Alignment = taLeftJustify
Foot.Brush.Color = clBtnFace Foot.Brush.Color = clBtnFace
Foot.Font.Color = clRed Foot.Font.Color = clRed
Foot.Font.Height = -13
Foot.Font.Name = 'MS Sans Serif'
Foot.Font.Style = [fsBold] Foot.Font.Style = [fsBold]
Foot.Text.Strings = ( Foot.Text.Strings = (
'This a LeftAligned Footer' 'This a LeftAligned Footer'
@ -40,15 +38,12 @@ object Form1: TForm1
Legend.Font.Name = 'MS Sans Serif' Legend.Font.Name = 'MS Sans Serif'
Title.Brush.Color = clBtnFace Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue Title.Font.Color = clBlue
Title.Font.Height = -11
Title.Font.Name = 'MS Sans Serif'
Title.Margin = 8 Title.Margin = 8
Title.Text.Strings = ( Title.Text.Strings = (
'Centered Chart Title' 'Centered Chart Title'
) )
Title.Visible = True Title.Visible = True
Align = alClient Align = alClient
ParentColor = False
object Chart1LineHor: TConstantLine object Chart1LineHor: TConstantLine
Legend.Visible = False Legend.Visible = False
Pen.Style = psDash Pen.Style = psDash
@ -63,107 +58,146 @@ object Form1: TForm1
end end
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 102 Height = 120
Top = 392 Top = 374
Width = 585 Width = 610
Align = alBottom Align = alBottom
ClientHeight = 102 AutoSize = True
ClientWidth = 585 ClientHeight = 120
ClientWidth = 610
TabOrder = 0 TabOrder = 0
object lblAdd: TLabel object lblAdd: TLabel
Left = 13 AnchorSideTop.Control = btnAddPie
Height = 13 AnchorSideTop.Side = asrCenter
Top = 10 AnchorSideRight.Control = lblClear
Width = 23 AnchorSideRight.Side = asrBottom
Left = 14
Height = 15
Top = 14
Width = 25
Anchors = [akTop, akRight]
Caption = 'Add:' Caption = 'Add:'
ParentColor = False ParentColor = False
end end
object lblClear: TLabel object lblClear: TLabel
Left = 13 AnchorSideLeft.Control = Panel1
Height = 13 AnchorSideTop.Control = btnClearPie
Top = 40 AnchorSideTop.Side = asrCenter
Width = 29 Left = 9
Height = 15
Top = 43
Width = 30
BorderSpacing.Left = 8
Caption = 'Clear:' Caption = 'Clear:'
ParentColor = False ParentColor = False
end end
object lblAddCount: TLabel object lblAddCount: TLabel
Left = 288 AnchorSideLeft.Control = btnClearAll
Height = 13 AnchorSideLeft.Side = asrBottom
Top = 8 AnchorSideTop.Control = btnAddPie
Width = 57 Left = 318
Height = 15
Top = 9
Width = 67
BorderSpacing.Left = 16
Caption = 'Multiple add' Caption = 'Multiple add'
ParentColor = False ParentColor = False
end end
object lblMarkStyle: TLabel object lblMarkStyle: TLabel
Left = 48 AnchorSideLeft.Control = btnAddPie
Height = 13 AnchorSideTop.Control = cbMarkStyle
Top = 80 AnchorSideTop.Side = asrCenter
Width = 77 Left = 47
Height = 15
Top = 92
Width = 86
Caption = 'Add with marks:' Caption = 'Add with marks:'
ParentColor = False ParentColor = False
end end
object lblReticule: TLabel object lblReticule: TLabel
Left = 360 AnchorSideTop.Control = cbReticule
Height = 13 AnchorSideTop.Side = asrCenter
Top = 80 AnchorSideRight.Control = cbReticule
Width = 42 Left = 371
Height = 15
Top = 92
Width = 45
Anchors = [akTop, akRight]
BorderSpacing.Right = 8
Caption = 'Reticule:' Caption = 'Reticule:'
ParentColor = False ParentColor = False
end end
object btnAddPie: TButton object btnAddPie: TButton
Left = 48 AnchorSideLeft.Control = btnClearPie
Height = 24 AnchorSideTop.Control = Panel1
Top = 8 Left = 47
Width = 40 Height = 25
BorderSpacing.InnerBorder = 4 Top = 9
Width = 42
AutoSize = True
BorderSpacing.Top = 8
Caption = 'Pie' Caption = 'Pie'
OnClick = btnAddPieClick OnClick = btnAddPieClick
TabOrder = 0 TabOrder = 0
end end
object btnAddLine: TButton object btnAddLine: TButton
Left = 192 AnchorSideLeft.Control = btnClearLine
Height = 24 AnchorSideTop.Control = btnAddPie
Top = 8 Left = 206
Width = 40 Height = 25
BorderSpacing.InnerBorder = 4 Top = 9
Width = 48
AutoSize = True
Caption = 'Line' Caption = 'Line'
OnClick = btnAddLineClick OnClick = btnAddLineClick
TabOrder = 1 TabOrder = 1
end end
object btnAddArea: TButton object btnAddArea: TButton
Left = 96 AnchorSideLeft.Control = btnClearArea
Height = 24 AnchorSideTop.Control = btnAddPie
Top = 8 Left = 97
Width = 40 Height = 25
BorderSpacing.InnerBorder = 4 Top = 9
Width = 50
AutoSize = True
Caption = 'Area' Caption = 'Area'
OnClick = btnAddAreaClick OnClick = btnAddAreaClick
TabOrder = 2 TabOrder = 2
end end
object btnAddBar: TButton object btnAddBar: TButton
Left = 144 AnchorSideLeft.Control = btnClearBar
Height = 24 AnchorSideTop.Control = btnAddPie
Top = 8 Left = 155
Width = 40 Height = 25
BorderSpacing.InnerBorder = 4 Top = 9
Width = 43
AutoSize = True
Caption = 'Bar' Caption = 'Bar'
OnClick = btnAddBarClick OnClick = btnAddBarClick
TabOrder = 3 TabOrder = 3
end end
object cbLegend: TCheckBox object cbLegend: TCheckBox
Left = 384 AnchorSideLeft.Control = edAddCount
Height = 17 AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
Left = 424
Height = 19
Top = 8 Top = 8
Width = 55 Width = 59
BorderSpacing.Left = 16
BorderSpacing.Top = 7
Caption = 'Legend' Caption = 'Legend'
OnChange = cbLegendChange OnChange = cbLegendChange
TabOrder = 4 TabOrder = 4
end end
object cbBottomAxis: TCheckBox object cbBottomAxis: TCheckBox
Left = 384 AnchorSideLeft.Control = cbLegend
Height = 17 AnchorSideTop.Control = cbLegend
Top = 24 AnchorSideTop.Side = asrBottom
Width = 77 Left = 424
Height = 19
Top = 27
Width = 84
Caption = 'Bottom Axis' Caption = 'Bottom Axis'
Checked = True Checked = True
OnChange = cbBottomAxisChange OnChange = cbBottomAxisChange
@ -171,10 +205,13 @@ object Form1: TForm1
TabOrder = 5 TabOrder = 5
end end
object cbLeftAxis: TCheckBox object cbLeftAxis: TCheckBox
Left = 384 AnchorSideLeft.Control = cbLegend
Height = 17 AnchorSideTop.Control = cbBottomAxis
Top = 40 AnchorSideTop.Side = asrBottom
Width = 62 Left = 424
Height = 19
Top = 46
Width = 64
Caption = 'Left Axis' Caption = 'Left Axis'
Checked = True Checked = True
OnChange = cbLeftAxisChange OnChange = cbLeftAxisChange
@ -182,10 +219,13 @@ object Form1: TForm1
TabOrder = 6 TabOrder = 6
end end
object cbTitle: TCheckBox object cbTitle: TCheckBox
Left = 496 AnchorSideLeft.Control = cbFooter
Height = 17 AnchorSideTop.Control = cbLegend
Left = 516
Height = 19
Top = 8 Top = 8
Width = 40 Width = 43
BorderSpacing.Right = 8
Caption = 'Title' Caption = 'Title'
Checked = True Checked = True
OnChange = cbTitleChange OnChange = cbTitleChange
@ -193,78 +233,113 @@ object Form1: TForm1
TabOrder = 7 TabOrder = 7
end end
object cbFooter: TCheckBox object cbFooter: TCheckBox
Left = 496 AnchorSideLeft.Control = cbBottomAxis
Height = 17 AnchorSideLeft.Side = asrBottom
Top = 24 AnchorSideTop.Control = cbLegend
Width = 52 AnchorSideTop.Side = asrBottom
Left = 516
Height = 19
Top = 27
Width = 54
BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'Footer' Caption = 'Footer'
OnChange = cbFooterChange OnChange = cbFooterChange
TabOrder = 8 TabOrder = 8
end end
object cbInverted: TCheckBox object cbInverted: TCheckBox
Left = 496 AnchorSideLeft.Control = cbFooter
Height = 17 AnchorSideTop.Control = cbFooter
Top = 40 AnchorSideTop.Side = asrBottom
Width = 62 Left = 516
Height = 19
Top = 46
Width = 63
BorderSpacing.Right = 8
Caption = 'Inverted' Caption = 'Inverted'
OnChange = cbInvertedChange OnChange = cbInvertedChange
TabOrder = 9 TabOrder = 9
end end
object btnClearBar: TButton object btnClearBar: TButton
Left = 144 AnchorSideLeft.Control = btnClearArea
Height = 24 AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnClearPie
Left = 155
Height = 25
Top = 38 Top = 38
Width = 40 Width = 43
BorderSpacing.InnerBorder = 4 AutoSize = True
BorderSpacing.Left = 8
Caption = 'Bar' Caption = 'Bar'
OnClick = btnClearBarClick OnClick = btnClearBarClick
TabOrder = 10 TabOrder = 10
end end
object btnClearArea: TButton object btnClearArea: TButton
Left = 96 AnchorSideLeft.Control = btnClearPie
Height = 24 AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnClearPie
Left = 97
Height = 25
Top = 38 Top = 38
Width = 40 Width = 50
BorderSpacing.InnerBorder = 4 AutoSize = True
BorderSpacing.Left = 8
Caption = 'Area' Caption = 'Area'
OnClick = btnClearAreaClick OnClick = btnClearAreaClick
TabOrder = 11 TabOrder = 11
end end
object btnClearLine: TButton object btnClearLine: TButton
Left = 192 AnchorSideLeft.Control = btnClearBar
Height = 24 AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnClearPie
Left = 206
Height = 25
Top = 38 Top = 38
Width = 40 Width = 48
BorderSpacing.InnerBorder = 4 AutoSize = True
BorderSpacing.Left = 8
Caption = 'Line' Caption = 'Line'
OnClick = btnClearLineClick OnClick = btnClearLineClick
TabOrder = 12 TabOrder = 12
end end
object btnClearPie: TButton object btnClearPie: TButton
Left = 48 AnchorSideLeft.Control = lblClear
Height = 24 AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnAddPie
AnchorSideTop.Side = asrBottom
Left = 47
Height = 25
Top = 38 Top = 38
Width = 40 Width = 42
BorderSpacing.InnerBorder = 4 AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Top = 4
Caption = 'Pie' Caption = 'Pie'
OnClick = btnClearPieClick OnClick = btnClearPieClick
TabOrder = 13 TabOrder = 13
end end
object edAddCount: TSpinEdit object edAddCount: TSpinEdit
Left = 288 AnchorSideLeft.Control = lblAddCount
Height = 21 AnchorSideTop.Control = lblAddCount
Top = 24 AnchorSideTop.Side = asrBottom
Left = 318
Height = 23
Top = 26
Width = 90 Width = 90
BorderSpacing.Top = 2
MaxValue = 1000000 MaxValue = 1000000
MinValue = 1 MinValue = 1
TabOrder = 14 TabOrder = 14
Value = 1 Value = 1
end end
object cbShowGridCheckBox: TCheckBox object cbShowGridCheckBox: TCheckBox
Left = 384 AnchorSideLeft.Control = cbLegend
Height = 17 AnchorSideTop.Control = cbLeftAxis
Top = 56 AnchorSideTop.Side = asrBottom
Width = 70 Left = 424
Height = 19
Top = 65
Width = 76
Caption = 'Show grid ' Caption = 'Show grid '
Checked = True Checked = True
OnChange = cbShowGridCheckBoxChange OnChange = cbShowGridCheckBoxChange
@ -272,20 +347,29 @@ object Form1: TForm1
TabOrder = 15 TabOrder = 15
end end
object cbShowAxisTitles: TCheckBox object cbShowAxisTitles: TCheckBox
Left = 496 AnchorSideLeft.Control = cbFooter
Height = 17 AnchorSideTop.Control = cbInverted
Top = 56 AnchorSideTop.Side = asrBottom
Width = 66 Left = 516
Height = 19
Top = 65
Width = 69
BorderSpacing.Right = 8
Caption = 'Axis titles' Caption = 'Axis titles'
OnChange = cbShowAxisTitlesChange OnChange = cbShowAxisTitlesChange
TabOrder = 16 TabOrder = 16
end end
object cbMarkStyle: TComboBox object cbMarkStyle: TComboBox
Left = 132 AnchorSideLeft.Control = lblMarkStyle
Height = 21 AnchorSideLeft.Side = asrBottom
Top = 76 AnchorSideTop.Control = cbReticule
Left = 141
Height = 23
Top = 88
Width = 136 Width = 136
ItemHeight = 13 BorderSpacing.Left = 8
BorderSpacing.Bottom = 8
ItemHeight = 15
ItemIndex = 5 ItemIndex = 5
Items.Strings = ( Items.Strings = (
'smsCustom' 'smsCustom'
@ -305,11 +389,17 @@ object Form1: TForm1
Text = 'smsLabelPercent' Text = 'smsLabelPercent'
end end
object cbReticule: TComboBox object cbReticule: TComboBox
Left = 416 AnchorSideLeft.Control = cbLegend
Height = 21 AnchorSideTop.Control = cbShowGridCheckBox
Top = 76 AnchorSideTop.Side = asrBottom
Width = 136 Left = 424
ItemHeight = 13 Height = 23
Top = 88
Width = 156
BorderSpacing.Top = 4
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 15
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'rmNone' 'rmNone'
@ -323,11 +413,15 @@ object Form1: TForm1
Text = 'rmNone' Text = 'rmNone'
end end
object btnClearAll: TButton object btnClearAll: TButton
Left = 240 AnchorSideLeft.Control = btnClearLine
Height = 24 AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnClearPie
Left = 262
Height = 25
Top = 38 Top = 38
Width = 40 Width = 40
BorderSpacing.InnerBorder = 4 AutoSize = True
BorderSpacing.Left = 8
Caption = 'All' Caption = 'All'
OnClick = btnClearAllClick OnClick = btnClearAllClick
TabOrder = 19 TabOrder = 19