TAChart: Add page control to the line demo

git-svn-id: trunk@27229 -
This commit is contained in:
ask 2010-08-29 13:28:59 +00:00
parent ea4be3fe87
commit 081172351f
3 changed files with 173 additions and 149 deletions

View File

@ -1,132 +1,152 @@
object Form1: TForm1
Left = 326
Height = 457
Top = 189
Width = 571
Left = 293
Height = 479
Top = 182
Width = 589
Caption = 'Form1'
ClientHeight = 457
ClientWidth = 571
ClientHeight = 479
ClientWidth = 589
Position = poScreenCenter
LCLVersion = '0.9.29'
object Panel1: TPanel
object PageControl2: TPageControl
Left = 0
Height = 42
Height = 479
Top = 0
Width = 571
Align = alTop
ClientHeight = 42
ClientWidth = 571
TabOrder = 0
object cbLineType: TComboBox
Left = 8
Height = 21
Top = 8
Width = 120
ItemHeight = 13
ItemIndex = 1
Items.Strings = (
'None'
'Previous'
'Origin'
'StepXY'
'StepYX'
)
OnChange = cbLineTypeChange
Style = csDropDownList
TabOrder = 0
Text = 'Previous'
end
object cb3D: TCheckBox
Left = 136
Height = 17
Top = 12
Width = 33
Caption = '3D'
OnChange = cb3DChange
TabOrder = 1
end
object cbRotated: TCheckBox
Left = 176
Height = 17
Top = 12
Width = 59
Caption = 'Rotated'
OnChange = cbRotatedChange
TabOrder = 2
end
object btnAddSeries: TButton
Left = 296
Height = 25
Top = 8
Width = 75
Caption = 'More series'
OnClick = btnAddSeriesClick
TabOrder = 3
end
object edTime: TEdit
Left = 468
Height = 21
Top = 8
Width = 76
Alignment = taRightJustify
TabOrder = 4
end
object btnRefresh: TButton
Left = 376
Height = 25
Top = 8
Width = 88
Caption = 'Timed refresh:'
OnClick = btnRefreshClick
TabOrder = 5
end
object cbSorted: TCheckBox
Left = 240
Height = 17
Top = 12
Width = 52
Caption = 'Sorted'
OnChange = cbSortedChange
TabOrder = 6
end
end
object Chart1: TChart
Left = 0
Height = 415
Top = 42
Width = 571
AxisList = <
item
Alignment = calLeft
Title.Font.Orientation = 900
end
item
Alignment = calBottom
end>
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue
Title.Text.Strings = (
'TAChart'
)
Toolset = ChartToolset1
Width = 589
ActivePage = tsFast
Align = alClient
DoubleBuffered = True
ParentColor = False
object Chart1LineSeries1: TLineSeries
LinePen.Color = clTeal
LinePen.Width = 3
SeriesColor = clTeal
Source = RandomChartSource1
end
object Chart1ConstantLine1: TConstantLine
LineStyle = lsVertical
Pen.Color = clAqua
Pen.Width = 2
Position = 0
SeriesColor = clAqua
ZPosition = 1
TabIndex = 0
TabOrder = 0
object tsFast: TTabSheet
Caption = 'Fast drawing'
ClientHeight = 453
ClientWidth = 581
object chFast: TChart
Left = 0
Height = 411
Top = 42
Width = 581
AxisList = <
item
Title.LabelFont.Orientation = 900
end
item
Alignment = calBottom
end>
Foot.Brush.Color = clBtnFace
Foot.Font.Color = clBlue
Title.Brush.Color = clBtnFace
Title.Font.Color = clBlue
Title.Text.Strings = (
'TAChart'
)
Toolset = ChartToolset1
Align = alClient
DoubleBuffered = True
ParentColor = False
object chFastLineSeries1: TLineSeries
LinePen.Color = clTeal
LinePen.Width = 3
Source = RandomChartSource1
end
object chFastConstantLine1: TConstantLine
LineStyle = lsVertical
Pen.Color = clAqua
Pen.Width = 2
Position = 0
SeriesColor = clAqua
ZPosition = 1
end
end
object Panel1: TPanel
Left = 0
Height = 42
Top = 0
Width = 581
Align = alTop
ClientHeight = 42
ClientWidth = 581
TabOrder = 1
object cbLineType: TComboBox
Left = 8
Height = 21
Top = 8
Width = 120
ItemHeight = 13
ItemIndex = 1
Items.Strings = (
'None'
'Previous'
'Origin'
'StepXY'
'StepYX'
)
OnChange = cbLineTypeChange
Style = csDropDownList
TabOrder = 0
Text = 'Previous'
end
object cb3D: TCheckBox
Left = 136
Height = 17
Top = 12
Width = 33
Caption = '3D'
OnChange = cb3DChange
TabOrder = 1
end
object cbRotated: TCheckBox
Left = 176
Height = 17
Top = 12
Width = 59
Caption = 'Rotated'
OnChange = cbRotatedChange
TabOrder = 2
end
object btnAddSeries: TButton
Left = 296
Height = 25
Top = 8
Width = 75
Caption = 'More series'
OnClick = btnAddSeriesClick
TabOrder = 3
end
object edTime: TEdit
Left = 468
Height = 21
Top = 8
Width = 76
Alignment = taRightJustify
TabOrder = 4
end
object btnRefresh: TButton
Left = 376
Height = 25
Top = 8
Width = 88
Caption = 'Timed refresh:'
OnClick = btnRefreshClick
TabOrder = 5
end
object cbSorted: TCheckBox
Left = 240
Height = 17
Top = 12
Width = 52
Caption = 'Sorted'
OnChange = cbSortedChange
TabOrder = 6
end
object PageControl1: TPageControl
Left = 114
Height = 200
Top = 41
Width = 200
TabOrder = 7
end
end
end
end
object RandomChartSource1: TRandomChartSource

View File

@ -5,8 +5,8 @@ unit Main;
interface
uses
Classes, ExtCtrls, StdCtrls, SysUtils, FileUtil, Forms, Controls, Graphics,
Dialogs, TAGraph, TASeries, TASources, TATools;
Classes, ComCtrls, ExtCtrls, StdCtrls, SysUtils, FileUtil, Forms, Controls,
Graphics, Dialogs, TAGraph, TASeries, TASources, TATools;
type
@ -19,16 +19,19 @@ type
cbLineType: TComboBox;
cbRotated: TCheckBox;
cbSorted: TCheckBox;
Chart1: TChart;
Chart1ConstantLine1: TConstantLine;
Chart1LineSeries1: TLineSeries;
chFast: TChart;
chFastConstantLine1: TConstantLine;
chFastLineSeries1: TLineSeries;
ChartToolset1: TChartToolset;
ChartToolset1DataPointDragTool1: TDataPointDragTool;
ChartToolset1PanDragTool1: TPanDragTool;
ChartToolset1ZoomDragTool1: TZoomDragTool;
edTime: TEdit;
PageControl1: TPageControl;
PageControl2: TPageControl;
Panel1: TPanel;
RandomChartSource1: TRandomChartSource;
tsFast: TTabSheet;
procedure btnAddSeriesClick(Sender: TObject);
procedure btnRefreshClick(Sender: TObject);
procedure cb3DChange(Sender: TObject);
@ -55,11 +58,11 @@ var
i, j: Integer;
begin
for i := 1 to 10 do begin
s := TLineSeries.Create(Chart1);
s := TLineSeries.Create(chFast);
s.SeriesColor := clRed;
for j := 1 to 10000 do
s.AddXY(j, Random * 5 + Chart1.SeriesCount * 10);
Chart1.AddSeries(s);
s.AddXY(j, Random * 5 + chFast.SeriesCount * 10);
chFast.AddSeries(s);
end;
end;
@ -68,7 +71,7 @@ var
t: TDateTime;
begin
t := Now;
Chart1.Refresh;
chFast.Refresh;
edTime.Text := FormatDateTime('s.zzz', Now - t) + ' s';
end;
@ -76,9 +79,9 @@ procedure TForm1.cb3DChange(Sender: TObject);
var
i: Integer;
begin
for i := 0 to Chart1.SeriesCount - 1 do
if Chart1.Series[i] is TLineSeries then
with Chart1.Series[i] as TLineSeries do
for i := 0 to chFast.SeriesCount - 1 do
if chFast.Series[i] is TLineSeries then
with chFast.Series[i] as TLineSeries do
Depth := 15 - Depth;
end;
@ -86,9 +89,9 @@ procedure TForm1.cbLineTypeChange(Sender: TObject);
var
i: Integer;
begin
for i := 0 to Chart1.SeriesCount - 1 do
if Chart1.Series[i] is TLineSeries then
with Chart1.Series[i] as TLineSeries do
for i := 0 to chFast.SeriesCount - 1 do
if chFast.Series[i] is TLineSeries then
with chFast.Series[i] as TLineSeries do
LineType := TLineType(cbLineType.ItemIndex);
end;
@ -96,9 +99,9 @@ procedure TForm1.cbRotatedChange(Sender: TObject);
var
i: Integer;
begin
for i := 0 to Chart1.SeriesCount - 1 do
if Chart1.Series[i] is TLineSeries then
with Chart1.Series[i] as TLineSeries do begin
for i := 0 to chFast.SeriesCount - 1 do
if chFast.Series[i] is TLineSeries then
with chFast.Series[i] as TLineSeries do begin
AxisIndexY := Ord(cbRotated.Checked);
AxisIndexX := 1 - AxisIndexY;
end;
@ -108,9 +111,9 @@ procedure TForm1.cbSortedChange(Sender: TObject);
var
i: Integer;
begin
for i := 0 to Chart1.SeriesCount - 1 do
if Chart1.Series[i] is TLineSeries then
with Chart1.Series[i] as TLineSeries do
for i := 0 to chFast.SeriesCount - 1 do
if chFast.Series[i] is TLineSeries then
with chFast.Series[i] as TLineSeries do
if Source is TListChartSource then
ListSource.Sorted := cbSorted.Checked;
end;

View File

@ -1,7 +1,7 @@
object Form1: TForm1
Left = 317
Left = 387
Height = 459
Top = 215
Top = 241
Width = 529
Caption = 'Form1'
ClientHeight = 459
@ -20,13 +20,13 @@ object Form1: TForm1
TabOrder = 0
object tsBubble: TTabSheet
Caption = 'Bubble'
ClientHeight = 347
ClientWidth = 463
ClientHeight = 433
ClientWidth = 521
object chBubble: TChart
Left = 0
Height = 347
Height = 433
Top = 0
Width = 463
Width = 521
AxisList = <
item
Title.LabelFont.Orientation = 900
@ -219,6 +219,7 @@ object Form1: TForm1
end
object ccsStacked: TCalculatedChartSource
Origin = rcsStacked
ReorderYList = '1'
left = 244
top = 136
end