TAChart: Update dragdrop demo to show Sorted property

git-svn-id: trunk@25913 -
This commit is contained in:
ask 2010-06-05 12:59:52 +00:00
parent cf2296e624
commit d940f2e95a
2 changed files with 40 additions and 19 deletions

View File

@ -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

View File

@ -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.