TAChart: Display total points count in line demo

git-svn-id: trunk@29798 -
This commit is contained in:
ask 2011-03-11 11:46:22 +00:00
parent 26ac2c3d21
commit 3082fa3f2e
4 changed files with 47 additions and 39 deletions

View File

@ -1,18 +1,18 @@
object Form1: TForm1 object Form1: TForm1
Left = 703 Left = 647
Height = 479 Height = 479
Top = 364 Top = 364
Width = 589 Width = 645
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 479 ClientHeight = 479
ClientWidth = 589 ClientWidth = 645
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '0.9.31' LCLVersion = '0.9.31'
object PageControl2: TPageControl object PageControl2: TPageControl
Left = 0 Left = 0
Height = 479 Height = 479
Top = 0 Top = 0
Width = 589 Width = 645
ActivePage = tsFast ActivePage = tsFast
Align = alClient Align = alClient
TabIndex = 0 TabIndex = 0
@ -20,12 +20,12 @@ object Form1: TForm1
object tsFast: TTabSheet object tsFast: TTabSheet
Caption = 'Fast drawing' Caption = 'Fast drawing'
ClientHeight = 453 ClientHeight = 453
ClientWidth = 581 ClientWidth = 637
object chFast: TChart object chFast: TChart
Left = 0 Left = 0
Height = 411 Height = 415
Top = 42 Top = 38
Width = 581 Width = 637
AxisList = < AxisList = <
item item
Title.LabelFont.Orientation = 900 Title.LabelFont.Orientation = 900
@ -59,18 +59,18 @@ object Form1: TForm1
end end
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 42 Height = 38
Top = 0 Top = 0
Width = 581 Width = 637
Align = alTop Align = alTop
ClientHeight = 42 ClientHeight = 38
ClientWidth = 581 ClientWidth = 637
TabOrder = 1 TabOrder = 1
object cbLineType: TComboBox object cbLineType: TComboBox
Left = 8 Left = 8
Height = 21 Height = 21
Top = 8 Top = 8
Width = 120 Width = 96
ItemHeight = 13 ItemHeight = 13
ItemIndex = 1 ItemIndex = 1
Items.Strings = ( Items.Strings = (
@ -86,7 +86,7 @@ object Form1: TForm1
Text = 'Previous' Text = 'Previous'
end end
object cb3D: TCheckBox object cb3D: TCheckBox
Left = 136 Left = 112
Height = 17 Height = 17
Top = 12 Top = 12
Width = 33 Width = 33
@ -95,7 +95,7 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
end end
object cbRotated: TCheckBox object cbRotated: TCheckBox
Left = 176 Left = 152
Height = 17 Height = 17
Top = 12 Top = 12
Width = 59 Width = 59
@ -104,33 +104,33 @@ object Form1: TForm1
TabOrder = 2 TabOrder = 2
end end
object btnAddSeries: TButton object btnAddSeries: TButton
Left = 296 Left = 372
Height = 25 Height = 25
Top = 8 Top = 6
Width = 75 Width = 31
Caption = 'More series' Caption = 'Add'
OnClick = btnAddSeriesClick OnClick = btnAddSeriesClick
TabOrder = 3 TabOrder = 3
end end
object edTime: TEdit object edTime: TEdit
Left = 468 Left = 496
Height = 21 Height = 21
Top = 8 Top = 6
Width = 76 Width = 76
Alignment = taRightJustify Alignment = taRightJustify
TabOrder = 4 TabOrder = 4
end end
object btnRefresh: TButton object btnRefresh: TButton
Left = 376 Left = 404
Height = 25 Height = 25
Top = 8 Top = 6
Width = 88 Width = 88
Caption = 'Timed refresh:' Caption = 'Timed refresh:'
OnClick = btnRefreshClick OnClick = btnRefreshClick
TabOrder = 5 TabOrder = 5
end end
object cbSorted: TCheckBox object cbSorted: TCheckBox
Left = 240 Left = 216
Height = 17 Height = 17
Top = 12 Top = 12
Width = 52 Width = 52
@ -138,12 +138,12 @@ object Form1: TForm1
OnChange = cbSortedChange OnChange = cbSortedChange
TabOrder = 6 TabOrder = 6
end end
object PageControl1: TPageControl object lblPointsCount: TLabel
Left = 114 Left = 282
Height = 200 Height = 1
Top = 41 Top = 14
Width = 200 Width = 1
TabOrder = 7 ParentColor = False
end end
end end
end end

View File

@ -15,16 +15,16 @@ type
TForm1 = class(TForm) TForm1 = class(TForm)
btnAddSeries: TButton; btnAddSeries: TButton;
btnRefresh: TButton; btnRefresh: TButton;
ccsAvg: TCalculatedChartSource;
cb3D: TCheckBox; cb3D: TCheckBox;
cbLineType: TComboBox; cbLineType: TComboBox;
cbRotated: TCheckBox; cbRotated: TCheckBox;
cbSorted: TCheckBox; cbSorted: TCheckBox;
ccsAvg: TCalculatedChartSource;
ccsSum: TCalculatedChartSource; ccsSum: TCalculatedChartSource;
chCalc: TChart; chCalc: TChart;
chCalcLineSeries1: TLineSeries; chCalcLineSeries1: TLineSeries;
chCalcLineSeriesSum: TLineSeries;
chCalcLineSeriesAvg: TLineSeries; chCalcLineSeriesAvg: TLineSeries;
chCalcLineSeriesSum: TLineSeries;
chFast: TChart; chFast: TChart;
chFastConstantLine1: TConstantLine; chFastConstantLine1: TConstantLine;
chFastLineSeries1: TLineSeries; chFastLineSeries1: TLineSeries;
@ -33,7 +33,7 @@ type
ChartToolset1PanDragTool1: TPanDragTool; ChartToolset1PanDragTool1: TPanDragTool;
ChartToolset1ZoomDragTool1: TZoomDragTool; ChartToolset1ZoomDragTool1: TZoomDragTool;
edTime: TEdit; edTime: TEdit;
PageControl1: TPageControl; lblPointsCount: TLabel;
PageControl2: TPageControl; PageControl2: TPageControl;
Panel1: TPanel; Panel1: TPanel;
RandomChartSource1: TRandomChartSource; RandomChartSource1: TRandomChartSource;
@ -60,6 +60,8 @@ uses
{ TForm1 } { TForm1 }
procedure TForm1.btnAddSeriesClick(Sender: TObject); procedure TForm1.btnAddSeriesClick(Sender: TObject);
const
POINTS_PER_SERIE = 50000;
var var
s: TLineSeries; s: TLineSeries;
i, j: Integer; i, j: Integer;
@ -67,10 +69,12 @@ begin
for i := 1 to 10 do begin for i := 1 to 10 do begin
s := TLineSeries.Create(chFast); s := TLineSeries.Create(chFast);
s.SeriesColor := clRed; s.SeriesColor := clRed;
for j := 1 to 50000 do for j := 1 to POINTS_PER_SERIE do
s.AddXY(j, Random * 5 + chFast.SeriesCount * 10); s.AddXY(j, Random * 5 + chFast.SeriesCount * 10);
chFast.AddSeries(s); chFast.AddSeries(s);
end; end;
lblPointsCount.Caption :=
Format('Points: %.2e', [chFast.SeriesCount * POINTS_PER_SERIE * 1.0]);
end; end;
procedure TForm1.btnRefreshClick(Sender: TObject); procedure TForm1.btnRefreshClick(Sender: TObject);

View File

@ -29,14 +29,18 @@
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="3">
<Item1> <Item1>
<PackageName Value="TAChartLazarusPkg"/> <PackageName Value="LCLBase"/>
<MinVersion Major="1" Valid="True"/> <MinVersion Major="1" Release="1" Valid="True"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="LCL"/> <PackageName Value="TAChartLazarusPkg"/>
<MinVersion Major="1" Valid="True"/>
</Item2> </Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="2"> <Units Count="2">
<Unit0> <Unit0>

View File

@ -51,9 +51,9 @@ type
procedure TestExpandRect; procedure TestExpandRect;
procedure TestLineIntersectsLine; procedure TestLineIntersectsLine;
procedure TestLineIntersectsRect; procedure TestLineIntersectsRect;
procedure TestPointInPolygon;
procedure TestPointOnLine; procedure TestPointOnLine;
procedure TestPointOperations; procedure TestPointOperations;
procedure TestPointInPolygon;
procedure TestPolygonIntersectsPolygon; procedure TestPolygonIntersectsPolygon;
end; end;