TAChart: Improved "basic" project in "demo" folder

git-svn-id: trunk@63690 -
This commit is contained in:
wp 2020-08-04 12:29:48 +00:00
parent c1d49b5369
commit 5e929bb85f
4 changed files with 38 additions and 34 deletions

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="11"/> <Version Value="12"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags> <Flags>
<LRSInOutputDirectory Value="False"/> <LRSInOutputDirectory Value="False"/>
<CompatibilityMode Value="True"/>
</Flags> </Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="TChart basic demo"/> <Title Value="TChart basic demo"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
@ -25,11 +25,14 @@
<DestinationDirectory Value="$(TestDir)\publishedproject\"/> <DestinationDirectory Value="$(TestDir)\publishedproject\"/>
</PublishOptions> </PublishOptions>
<RunParams> <RunParams>
<local>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
<FormatVersion Value="2"/> <FormatVersion Value="2"/>
<Modes Count="1"> <Modes Count="1">
<Mode0 Name="default"> <Mode0 Name="default">
<local> <local>
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T &apos;Lazarus Run Output&apos; -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local> </local>
</Mode0> </Mode0>
</Modes> </Modes>
@ -74,10 +77,6 @@
</SyntaxOptions> </SyntaxOptions>
</Parsing> </Parsing>
<Linking> <Linking>
<Debugging>
<DebugInfoType Value="dsStabs"/>
<UseExternalDbgSyms Value="True"/>
</Debugging>
<LinkSmart Value="True"/> <LinkSmart Value="True"/>
<Options> <Options>
<Win32> <Win32>

View File

@ -13,7 +13,7 @@ uses
{$R *.res} {$R *.res}
begin begin
Application.Title := 'TChart basic demo'; Application.Title:='TChart basic demo';
Application.Initialize; Application.Initialize;
Application.CreateForm(TForm1, Form1); Application.CreateForm(TForm1, Form1);
Application.Run; Application.Run;

View File

@ -10,7 +10,7 @@ object Form1: TForm1
LCLVersion = '2.1.0.0' LCLVersion = '2.1.0.0'
object Chart1: TChart object Chart1: TChart
Left = 0 Left = 0
Height = 374 Height = 372
Top = 0 Top = 0
Width = 610 Width = 610
AntialiasingMode = amOn AntialiasingMode = amOn
@ -52,23 +52,21 @@ object Form1: TForm1
object Chart1LineHor: TConstantLine object Chart1LineHor: TConstantLine
Legend.Visible = False Legend.Visible = False
Pen.Style = psDash Pen.Style = psDash
Position = 0
end end
object Chart1LineVert: TConstantLine object Chart1LineVert: TConstantLine
Legend.Visible = False Legend.Visible = False
LineStyle = lsVertical LineStyle = lsVertical
Pen.Style = psDash Pen.Style = psDash
Position = 0
end end
end end
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 120 Height = 122
Top = 374 Top = 372
Width = 610 Width = 610
Align = alBottom Align = alBottom
AutoSize = True AutoSize = True
ClientHeight = 120 ClientHeight = 122
ClientWidth = 610 ClientWidth = 610
TabOrder = 0 TabOrder = 0
object lblAdd: TLabel object lblAdd: TLabel
@ -114,7 +112,7 @@ object Form1: TForm1
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 47 Left = 47
Height = 15 Height = 15
Top = 92 Top = 94
Width = 86 Width = 86
Caption = 'Add with marks:' Caption = 'Add with marks:'
ParentColor = False ParentColor = False
@ -189,7 +187,7 @@ object Form1: TForm1
Left = 424 Left = 424
Height = 19 Height = 19
Top = 27 Top = 27
Width = 84 Width = 85
Caption = 'Bottom Axis' Caption = 'Bottom Axis'
Checked = True Checked = True
OnChange = cbBottomAxisChange OnChange = cbBottomAxisChange
@ -203,7 +201,7 @@ object Form1: TForm1
Left = 424 Left = 424
Height = 19 Height = 19
Top = 46 Top = 46
Width = 64 Width = 65
Caption = 'Left Axis' Caption = 'Left Axis'
Checked = True Checked = True
OnChange = cbLeftAxisChange OnChange = cbLeftAxisChange
@ -213,10 +211,10 @@ object Form1: TForm1
object cbTitle: TCheckBox object cbTitle: TCheckBox
AnchorSideLeft.Control = cbFooter AnchorSideLeft.Control = cbFooter
AnchorSideTop.Control = cbLegend AnchorSideTop.Control = cbLegend
Left = 516 Left = 517
Height = 19 Height = 19
Top = 8 Top = 8
Width = 43 Width = 42
BorderSpacing.Right = 8 BorderSpacing.Right = 8
Caption = 'Title' Caption = 'Title'
Checked = True Checked = True
@ -229,7 +227,7 @@ object Form1: TForm1
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbLegend AnchorSideTop.Control = cbLegend
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 516 Left = 517
Height = 19 Height = 19
Top = 27 Top = 27
Width = 54 Width = 54
@ -243,7 +241,7 @@ object Form1: TForm1
AnchorSideLeft.Control = cbFooter AnchorSideLeft.Control = cbFooter
AnchorSideTop.Control = cbFooter AnchorSideTop.Control = cbFooter
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 516 Left = 517
Height = 19 Height = 19
Top = 46 Top = 46
Width = 63 Width = 63
@ -342,10 +340,10 @@ object Form1: TForm1
AnchorSideLeft.Control = cbFooter AnchorSideLeft.Control = cbFooter
AnchorSideTop.Control = cbInverted AnchorSideTop.Control = cbInverted
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 516 Left = 517
Height = 19 Height = 19
Top = 65 Top = 65
Width = 69 Width = 70
BorderSpacing.Right = 8 BorderSpacing.Right = 8
Caption = 'Axis titles' Caption = 'Axis titles'
OnChange = cbShowAxisTitlesChange OnChange = cbShowAxisTitlesChange
@ -354,9 +352,10 @@ object Form1: TForm1
object cbMarkStyle: TComboBox object cbMarkStyle: TComboBox
AnchorSideLeft.Control = lblMarkStyle AnchorSideLeft.Control = lblMarkStyle
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbCrosshairTool
Left = 141 Left = 141
Height = 23 Height = 23
Top = 88 Top = 90
Width = 136 Width = 136
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
@ -394,12 +393,12 @@ object Form1: TForm1
TabOrder = 18 TabOrder = 18
end end
object lblCrossHairTool: TLabel object lblCrossHairTool: TLabel
AnchorSideTop.Control = lblMarkStyle AnchorSideTop.Control = cbCrosshairTool
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = cbCrosshairTool AnchorSideRight.Control = cbCrosshairTool
Left = 340 Left = 340
Height = 15 Height = 15
Top = 92 Top = 94
Width = 76 Width = 76
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 8 BorderSpacing.Right = 8
@ -408,10 +407,13 @@ object Form1: TForm1
end end
object cbCrosshairTool: TComboBox object cbCrosshairTool: TComboBox
AnchorSideLeft.Control = cbShowGridCheckBox AnchorSideLeft.Control = cbShowGridCheckBox
AnchorSideTop.Control = cbShowGridCheckBox
AnchorSideTop.Side = asrBottom
Left = 424 Left = 424
Height = 23 Height = 23
Top = 88 Top = 90
Width = 155 Width = 155
BorderSpacing.Top = 6
ItemHeight = 15 ItemHeight = 15
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
@ -427,8 +429,8 @@ object Form1: TForm1
end end
end end
object ChartToolset1: TChartToolset object ChartToolset1: TChartToolset
left = 240 Left = 240
top = 115 Top = 115
object DataPointCrosshairTool: TDataPointCrosshairTool object DataPointCrosshairTool: TDataPointCrosshairTool
end end
end end

View File

@ -82,7 +82,7 @@ implementation
{$R *.lfm} {$R *.lfm}
uses uses
Math, TAChartUtils, TATextElements, TATypes; Math, GraphUtil, TAChartUtils, TATextElements, TATypes;
{ TForm1 } { TForm1 }
@ -106,7 +106,7 @@ begin
if random(2) >= 0.7 then Y3 := Y3 + random(5) if random(2) >= 0.7 then Y3 := Y3 + random(5)
else if random(2) >= 0.7 then Y3 := 0 else if random(2) >= 0.7 then Y3 := 0
else Y3 := Y3 - random(5); else Y3 := Y3 - random(5);
FArea.AddXY(x3, y3, '', clTAColor); FArea.AddXY(x3, y3, Format('Area%d', [i]));
end; end;
end; end;
@ -118,7 +118,7 @@ begin
BringToFront(FBar); BringToFront(FBar);
FBar.Marks.Style := TSeriesMarksStyle(cbMarkStyle.ItemIndex); FBar.Marks.Style := TSeriesMarksStyle(cbMarkStyle.ItemIndex);
for i := 1 to edAddCount.Value do begin for i := 1 to edAddCount.Value do begin
FBar.AddXY(x, y, '', clBlue * (i mod 2) + clTAColor * (1 - i mod 2)); FBar.AddXY(x, y, Format('Bar%d', [i]));
X := X + 1; X := X + 1;
if random(2) >= 0.7 then Y := Y + random(5) if random(2) >= 0.7 then Y := Y + random(5)
else if random(2) >= 0.7 then Y := 0 else if random(2) >= 0.7 then Y := 0
@ -134,7 +134,7 @@ begin
BringToFront(FLine); BringToFront(FLine);
FLine.Marks.Style := TSeriesMarksStyle(cbMarkStyle.ItemIndex); FLine.Marks.Style := TSeriesMarksStyle(cbMarkStyle.ItemIndex);
for i := 1 to edAddCount.Value do begin for i := 1 to edAddCount.Value do begin
FLine.AddXY(x1, y1, '', IfThen(i mod 2 = 0, clGreen, clBlue)); FLine.AddXY(x1, y1, Format('Line%d', [i]));
X1 := X1 + 1.5; X1 := X1 + 1.5;
if random(2) >= 0.5 then Y1 := Y1 + random(10) if random(2) >= 0.5 then Y1 := Y1 + random(10)
else Y1 := Y1 - random(5); else Y1 := Y1 - random(5);
@ -254,6 +254,7 @@ begin
FArea := TAreaSeries.Create(Chart1); FArea := TAreaSeries.Create(Chart1);
FArea.SeriesColor := clFuchsia; FArea.SeriesColor := clFuchsia;
FArea.Title := 'area'; FArea.Title := 'area';
FArea.Marks.LabelBrush.Color := GetHighlightColor(FArea.SeriesColor, 100);
Chart1.AddSeries(FArea); Chart1.AddSeries(FArea);
end; end;
@ -261,7 +262,8 @@ procedure TForm1.InitBar;
begin begin
FBar := TBarSeries.Create(Chart1); FBar := TBarSeries.Create(Chart1);
FBar.Title := 'bars'; FBar.Title := 'bars';
FBar.SeriesColor := clGreen; FBar.BarBrush.Color := clGreen;
FBar.Marks.LabelBrush.Color := GetHighlightColor(FBar.BarBrush.Color, 100);
Chart1.AddSeries(FBar); Chart1.AddSeries(FBar);
end; end;
@ -274,6 +276,7 @@ begin
FLine.Pointer.Brush.Color := clRed; FLine.Pointer.Brush.Color := clRed;
FLine.Title := 'line'; FLine.Title := 'line';
FLine.SeriesColor := clRed; FLine.SeriesColor := clRed;
FLine.Marks.LabelBrush.Color := GetHighlightColor(FLine.SeriesColor, 100);
Chart1.AddSeries(FLine); Chart1.AddSeries(FLine);
end; end;