From d940f2e95a18c970a6651e99d2e8f9b6c122be3a Mon Sep 17 00:00:00 2001 From: ask Date: Sat, 5 Jun 2010 12:59:52 +0000 Subject: [PATCH] TAChart: Update dragdrop demo to show Sorted property git-svn-id: trunk@25913 - --- components/tachart/demo/dragdrop/main.lfm | 42 ++++++++++++++++------- components/tachart/demo/dragdrop/main.pas | 17 +++++---- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/components/tachart/demo/dragdrop/main.lfm b/components/tachart/demo/dragdrop/main.lfm index edb0840d0a..cf6973a7c5 100644 --- a/components/tachart/demo/dragdrop/main.lfm +++ b/components/tachart/demo/dragdrop/main.lfm @@ -1,18 +1,19 @@ object Form1: TForm1 - Left = 739 - Height = 300 - Top = 341 - Width = 400 + Left = 404 + Height = 481 + Top = 180 + Width = 483 Caption = 'Form1' - ClientHeight = 300 - ClientWidth = 400 + ClientHeight = 481 + ClientWidth = 483 OnCreate = FormCreate + Position = poScreenCenter LCLVersion = '0.9.29' object Chart1: TChart Left = 0 - Height = 300 - Top = 0 - Width = 400 + Height = 447 + Top = 34 + Width = 483 AxisList = < item Alignment = calLeft @@ -26,8 +27,7 @@ object Form1: TForm1 Title.Brush.Color = clBtnFace Title.Font.Color = clBlue Title.Text.Strings = ( - 'You can drag data points' - 'while holding Shift key' + 'Drag data points while holding Shift key' ) Title.Visible = True Toolset = ChartToolset1 @@ -38,7 +38,6 @@ object Form1: TForm1 Marks.Clipped = False Marks.Format = '%0:.9g' Marks.Style = smsValue - OnGetMark = Chart1LineSeries1GetMark Pointer.Brush.Color = clPurple Pointer.HorizSize = 6 Pointer.Style = psDiamond @@ -47,6 +46,25 @@ object Form1: TForm1 ShowPoints = True end end + object Panel1: TPanel + Left = 0 + Height = 34 + Top = 0 + Width = 483 + Align = alTop + ClientHeight = 34 + ClientWidth = 483 + TabOrder = 1 + object cbSorted: TCheckBox + Left = 12 + Height = 17 + Top = 8 + Width = 52 + Caption = 'Sorted' + OnChange = cbSortedChange + TabOrder = 0 + end + end object ChartToolset1: TChartToolset left = 99 top = 129 diff --git a/components/tachart/demo/dragdrop/main.pas b/components/tachart/demo/dragdrop/main.pas index 5a65ebe7b2..8b2b969304 100644 --- a/components/tachart/demo/dragdrop/main.pas +++ b/components/tachart/demo/dragdrop/main.pas @@ -5,8 +5,8 @@ unit Main; interface uses - Classes, ExtCtrls, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, - Dialogs, TAGraph, TASeries, TATools; + Classes, ExtCtrls, StdCtrls, SysUtils, FileUtil, LResources, Forms, Controls, + Graphics, Dialogs, TAGraph, TASeries, TATools; type @@ -17,12 +17,12 @@ type Chart1LineSeries1: TLineSeries; ChartToolset1: TChartToolset; ChartToolset1DataPointDragTool1: TDataPointDragTool; + cbSorted: TCheckBox; + Panel1: TPanel; + procedure cbSortedChange(Sender: TObject); procedure Chart1LineSeries1GetMark(out AFormattedMark: String; AIndex: Integer); procedure FormCreate(Sender: TObject); - private - FDragIndex: Integer; - FNearestIndex: Integer; end; var @@ -37,6 +37,11 @@ uses { TForm1 } +procedure TForm1.cbSortedChange(Sender: TObject); +begin + Chart1LineSeries1.ListSource.Sorted := cbSorted.Checked; +end; + procedure TForm1.Chart1LineSeries1GetMark( out AFormattedMark: String; AIndex: Integer); begin @@ -54,8 +59,6 @@ begin RandSeed := 675402; for i := 1 to 10 do Chart1LineSeries1.AddXY(i, Random(20) - 10); - FDragIndex := -1; - FNearestIndex := -1; end; end.