From 3082fa3f2ed7b3259d2151e3383d99216dacfc79 Mon Sep 17 00:00:00 2001 From: ask Date: Fri, 11 Mar 2011 11:46:22 +0000 Subject: [PATCH] TAChart: Display total points count in line demo git-svn-id: trunk@29798 - --- components/tachart/demo/line/Main.lfm | 60 +++++++++++------------ components/tachart/demo/line/Main.pas | 12 +++-- components/tachart/demo/line/linedemo.lpi | 12 +++-- components/tachart/test/UtilsTest.pas | 2 +- 4 files changed, 47 insertions(+), 39 deletions(-) diff --git a/components/tachart/demo/line/Main.lfm b/components/tachart/demo/line/Main.lfm index b05c8bb300..82b04ceec4 100644 --- a/components/tachart/demo/line/Main.lfm +++ b/components/tachart/demo/line/Main.lfm @@ -1,18 +1,18 @@ object Form1: TForm1 - Left = 703 + Left = 647 Height = 479 Top = 364 - Width = 589 + Width = 645 Caption = 'Form1' ClientHeight = 479 - ClientWidth = 589 + ClientWidth = 645 Position = poScreenCenter LCLVersion = '0.9.31' object PageControl2: TPageControl Left = 0 Height = 479 Top = 0 - Width = 589 + Width = 645 ActivePage = tsFast Align = alClient TabIndex = 0 @@ -20,12 +20,12 @@ object Form1: TForm1 object tsFast: TTabSheet Caption = 'Fast drawing' ClientHeight = 453 - ClientWidth = 581 + ClientWidth = 637 object chFast: TChart Left = 0 - Height = 411 - Top = 42 - Width = 581 + Height = 415 + Top = 38 + Width = 637 AxisList = < item Title.LabelFont.Orientation = 900 @@ -59,18 +59,18 @@ object Form1: TForm1 end object Panel1: TPanel Left = 0 - Height = 42 + Height = 38 Top = 0 - Width = 581 + Width = 637 Align = alTop - ClientHeight = 42 - ClientWidth = 581 + ClientHeight = 38 + ClientWidth = 637 TabOrder = 1 object cbLineType: TComboBox Left = 8 Height = 21 Top = 8 - Width = 120 + Width = 96 ItemHeight = 13 ItemIndex = 1 Items.Strings = ( @@ -86,7 +86,7 @@ object Form1: TForm1 Text = 'Previous' end object cb3D: TCheckBox - Left = 136 + Left = 112 Height = 17 Top = 12 Width = 33 @@ -95,7 +95,7 @@ object Form1: TForm1 TabOrder = 1 end object cbRotated: TCheckBox - Left = 176 + Left = 152 Height = 17 Top = 12 Width = 59 @@ -104,33 +104,33 @@ object Form1: TForm1 TabOrder = 2 end object btnAddSeries: TButton - Left = 296 + Left = 372 Height = 25 - Top = 8 - Width = 75 - Caption = 'More series' + Top = 6 + Width = 31 + Caption = 'Add' OnClick = btnAddSeriesClick TabOrder = 3 end object edTime: TEdit - Left = 468 + Left = 496 Height = 21 - Top = 8 + Top = 6 Width = 76 Alignment = taRightJustify TabOrder = 4 end object btnRefresh: TButton - Left = 376 + Left = 404 Height = 25 - Top = 8 + Top = 6 Width = 88 Caption = 'Timed refresh:' OnClick = btnRefreshClick TabOrder = 5 end object cbSorted: TCheckBox - Left = 240 + Left = 216 Height = 17 Top = 12 Width = 52 @@ -138,12 +138,12 @@ object Form1: TForm1 OnChange = cbSortedChange TabOrder = 6 end - object PageControl1: TPageControl - Left = 114 - Height = 200 - Top = 41 - Width = 200 - TabOrder = 7 + object lblPointsCount: TLabel + Left = 282 + Height = 1 + Top = 14 + Width = 1 + ParentColor = False end end end diff --git a/components/tachart/demo/line/Main.pas b/components/tachart/demo/line/Main.pas index 95e8dbafc2..3e89ac22d8 100644 --- a/components/tachart/demo/line/Main.pas +++ b/components/tachart/demo/line/Main.pas @@ -15,16 +15,16 @@ type TForm1 = class(TForm) btnAddSeries: TButton; btnRefresh: TButton; - ccsAvg: TCalculatedChartSource; cb3D: TCheckBox; cbLineType: TComboBox; cbRotated: TCheckBox; cbSorted: TCheckBox; + ccsAvg: TCalculatedChartSource; ccsSum: TCalculatedChartSource; chCalc: TChart; chCalcLineSeries1: TLineSeries; - chCalcLineSeriesSum: TLineSeries; chCalcLineSeriesAvg: TLineSeries; + chCalcLineSeriesSum: TLineSeries; chFast: TChart; chFastConstantLine1: TConstantLine; chFastLineSeries1: TLineSeries; @@ -33,7 +33,7 @@ type ChartToolset1PanDragTool1: TPanDragTool; ChartToolset1ZoomDragTool1: TZoomDragTool; edTime: TEdit; - PageControl1: TPageControl; + lblPointsCount: TLabel; PageControl2: TPageControl; Panel1: TPanel; RandomChartSource1: TRandomChartSource; @@ -60,6 +60,8 @@ uses { TForm1 } procedure TForm1.btnAddSeriesClick(Sender: TObject); +const + POINTS_PER_SERIE = 50000; var s: TLineSeries; i, j: Integer; @@ -67,10 +69,12 @@ begin for i := 1 to 10 do begin s := TLineSeries.Create(chFast); 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); chFast.AddSeries(s); end; + lblPointsCount.Caption := + Format('Points: %.2e', [chFast.SeriesCount * POINTS_PER_SERIE * 1.0]); end; procedure TForm1.btnRefreshClick(Sender: TObject); diff --git a/components/tachart/demo/line/linedemo.lpi b/components/tachart/demo/line/linedemo.lpi index 3656a488b5..cd0d232970 100644 --- a/components/tachart/demo/line/linedemo.lpi +++ b/components/tachart/demo/line/linedemo.lpi @@ -29,14 +29,18 @@ - + - - + + - + + + + + diff --git a/components/tachart/test/UtilsTest.pas b/components/tachart/test/UtilsTest.pas index c55ec5c3a7..fe2648a2d6 100644 --- a/components/tachart/test/UtilsTest.pas +++ b/components/tachart/test/UtilsTest.pas @@ -51,9 +51,9 @@ type procedure TestExpandRect; procedure TestLineIntersectsLine; procedure TestLineIntersectsRect; + procedure TestPointInPolygon; procedure TestPointOnLine; procedure TestPointOperations; - procedure TestPointInPolygon; procedure TestPolygonIntersectsPolygon; end;