mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 22:19:18 +02:00
TAChart: Add "Oscilloscope" page to the line demo
git-svn-id: trunk@33022 -
This commit is contained in:
parent
a6962d3529
commit
8b2d7d1c32
@ -1,32 +1,33 @@
|
|||||||
object Form1: TForm1
|
object Form1: TForm1
|
||||||
Left = 647
|
Left = 605
|
||||||
Height = 479
|
Height = 479
|
||||||
Top = 364
|
Top = 364
|
||||||
Width = 645
|
Width = 691
|
||||||
Caption = 'Form1'
|
Caption = 'Form1'
|
||||||
ClientHeight = 479
|
ClientHeight = 479
|
||||||
ClientWidth = 645
|
ClientWidth = 691
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '0.9.31'
|
||||||
object PageControl2: TPageControl
|
object PageControl1: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 479
|
Height = 479
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 645
|
Width = 691
|
||||||
ActivePage = tsFast
|
ActivePage = tsFast
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabIndex = 0
|
TabIndex = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
OnChange = PageControl1Change
|
||||||
object tsFast: TTabSheet
|
object tsFast: TTabSheet
|
||||||
Caption = 'Fast drawing'
|
Caption = 'Fast drawing'
|
||||||
ClientHeight = 453
|
ClientHeight = 453
|
||||||
ClientWidth = 637
|
ClientWidth = 683
|
||||||
object chFast: TChart
|
object chFast: TChart
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 415
|
Height = 415
|
||||||
Top = 38
|
Top = 38
|
||||||
Width = 637
|
Width = 683
|
||||||
AxisList = <
|
AxisList = <
|
||||||
item
|
item
|
||||||
Minors = <>
|
Minors = <>
|
||||||
@ -64,10 +65,10 @@ object Form1: TForm1
|
|||||||
Left = 0
|
Left = 0
|
||||||
Height = 38
|
Height = 38
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 637
|
Width = 683
|
||||||
Align = alTop
|
Align = alTop
|
||||||
ClientHeight = 38
|
ClientHeight = 38
|
||||||
ClientWidth = 637
|
ClientWidth = 683
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object cbLineType: TComboBox
|
object cbLineType: TComboBox
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -153,12 +154,12 @@ object Form1: TForm1
|
|||||||
object tsPointers: TTabSheet
|
object tsPointers: TTabSheet
|
||||||
Caption = 'Pointers'
|
Caption = 'Pointers'
|
||||||
ClientHeight = 453
|
ClientHeight = 453
|
||||||
ClientWidth = 637
|
ClientWidth = 683
|
||||||
object chPointers: TChart
|
object chPointers: TChart
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 453
|
Height = 453
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 467
|
Width = 513
|
||||||
AxisList = <
|
AxisList = <
|
||||||
item
|
item
|
||||||
Minors = <>
|
Minors = <>
|
||||||
@ -181,7 +182,7 @@ object Form1: TForm1
|
|||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object pnlPointers: TPanel
|
object pnlPointers: TPanel
|
||||||
Left = 467
|
Left = 513
|
||||||
Height = 453
|
Height = 453
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 170
|
Width = 170
|
||||||
@ -208,6 +209,51 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
object tsOscilloscope: TTabSheet
|
||||||
|
Caption = 'Oscilloscope'
|
||||||
|
ClientHeight = 453
|
||||||
|
ClientWidth = 683
|
||||||
|
object chOscillator: TChart
|
||||||
|
Left = 0
|
||||||
|
Height = 453
|
||||||
|
Top = 0
|
||||||
|
Width = 683
|
||||||
|
AxisList = <
|
||||||
|
item
|
||||||
|
Grid.Color = clMedGray
|
||||||
|
Minors = <>
|
||||||
|
Range.Max = 2
|
||||||
|
Range.Min = -2
|
||||||
|
Range.UseMax = True
|
||||||
|
Range.UseMin = True
|
||||||
|
Title.LabelFont.Orientation = 900
|
||||||
|
end
|
||||||
|
item
|
||||||
|
Grid.Color = clMedGray
|
||||||
|
Alignment = calBottom
|
||||||
|
Minors = <>
|
||||||
|
Transformations = catOscillator
|
||||||
|
end>
|
||||||
|
BackColor = clBlack
|
||||||
|
Foot.Brush.Color = clBtnFace
|
||||||
|
Foot.Font.Color = clBlue
|
||||||
|
Title.Brush.Color = clBtnFace
|
||||||
|
Title.Font.Color = clBlue
|
||||||
|
Title.Text.Strings = (
|
||||||
|
'TAChart'
|
||||||
|
)
|
||||||
|
Align = alClient
|
||||||
|
DoubleBuffered = True
|
||||||
|
ParentColor = False
|
||||||
|
object chOscillatorLineSeries1: TLineSeries
|
||||||
|
AxisIndexX = 1
|
||||||
|
LinePen.Color = clLime
|
||||||
|
LinePen.Width = 2
|
||||||
|
LineType = ltStepXY
|
||||||
|
Source = lcsOscillator
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object RandomChartSource1: TRandomChartSource
|
object RandomChartSource1: TRandomChartSource
|
||||||
PointsNumber = 25
|
PointsNumber = 25
|
||||||
@ -254,4 +300,24 @@ object Form1: TForm1
|
|||||||
left = 464
|
left = 464
|
||||||
top = 160
|
top = 160
|
||||||
end
|
end
|
||||||
|
object lcsOscillator: TListChartSource
|
||||||
|
DataPoints.Strings = (
|
||||||
|
'0|0|?|'
|
||||||
|
)
|
||||||
|
left = 464
|
||||||
|
top = 316
|
||||||
|
end
|
||||||
|
object timOscilloscope: TTimer
|
||||||
|
Enabled = False
|
||||||
|
Interval = 150
|
||||||
|
OnTimer = timOscilloscopeTimer
|
||||||
|
left = 408
|
||||||
|
top = 376
|
||||||
|
end
|
||||||
|
object catOscillator: TChartAxisTransformations
|
||||||
|
left = 464
|
||||||
|
top = 376
|
||||||
|
object catOscillatorLinearAxisTransform1: TLinearAxisTransform
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -6,7 +6,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, ComCtrls, ExtCtrls, Spin, StdCtrls, SysUtils, FileUtil, Forms,
|
Classes, ComCtrls, ExtCtrls, Spin, StdCtrls, SysUtils, FileUtil, Forms,
|
||||||
Controls, Graphics, Dialogs, TAGraph, TASeries, TASources, TATools;
|
Controls, Graphics, Dialogs, TAGraph, TASeries, TASources, TATools,
|
||||||
|
TATransformations, TACustomSeries;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ type
|
|||||||
TForm1 = class(TForm)
|
TForm1 = class(TForm)
|
||||||
btnAddSeries: TButton;
|
btnAddSeries: TButton;
|
||||||
btnRefresh: TButton;
|
btnRefresh: TButton;
|
||||||
|
catOscillatorLinearAxisTransform1: TLinearAxisTransform;
|
||||||
cb3D: TCheckBox;
|
cb3D: TCheckBox;
|
||||||
cbLineType: TComboBox;
|
cbLineType: TComboBox;
|
||||||
cbRotated: TCheckBox;
|
cbRotated: TCheckBox;
|
||||||
@ -22,6 +24,9 @@ type
|
|||||||
ccsAvg: TCalculatedChartSource;
|
ccsAvg: TCalculatedChartSource;
|
||||||
ccsDerivative: TCalculatedChartSource;
|
ccsDerivative: TCalculatedChartSource;
|
||||||
ccsSum: TCalculatedChartSource;
|
ccsSum: TCalculatedChartSource;
|
||||||
|
catOscillator: TChartAxisTransformations;
|
||||||
|
chOscillator: TChart;
|
||||||
|
chOscillatorLineSeries1: TLineSeries;
|
||||||
chPointers: TChart;
|
chPointers: TChart;
|
||||||
chFast: TChart;
|
chFast: TChart;
|
||||||
chFastConstantLine1: TConstantLine;
|
chFastConstantLine1: TConstantLine;
|
||||||
@ -33,11 +38,14 @@ type
|
|||||||
edTime: TEdit;
|
edTime: TEdit;
|
||||||
lblPointerSize: TLabel;
|
lblPointerSize: TLabel;
|
||||||
lblPointsCount: TLabel;
|
lblPointsCount: TLabel;
|
||||||
PageControl2: TPageControl;
|
lcsOscillator: TListChartSource;
|
||||||
|
PageControl1: TPageControl;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
pnlPointers: TPanel;
|
pnlPointers: TPanel;
|
||||||
RandomChartSource1: TRandomChartSource;
|
RandomChartSource1: TRandomChartSource;
|
||||||
sePointerSize: TSpinEdit;
|
sePointerSize: TSpinEdit;
|
||||||
|
timOscilloscope: TTimer;
|
||||||
|
tsOscilloscope: TTabSheet;
|
||||||
tsPointers: TTabSheet;
|
tsPointers: TTabSheet;
|
||||||
tsFast: TTabSheet;
|
tsFast: TTabSheet;
|
||||||
procedure btnAddSeriesClick(Sender: TObject);
|
procedure btnAddSeriesClick(Sender: TObject);
|
||||||
@ -47,7 +55,9 @@ type
|
|||||||
procedure cbRotatedChange(Sender: TObject);
|
procedure cbRotatedChange(Sender: TObject);
|
||||||
procedure cbSortedChange(Sender: TObject);
|
procedure cbSortedChange(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure PageControl1Change(Sender: TObject);
|
||||||
procedure sePointerSizeChange(Sender: TObject);
|
procedure sePointerSizeChange(Sender: TObject);
|
||||||
|
procedure timOscilloscopeTimer(Sender: TObject);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -151,6 +161,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.PageControl1Change(Sender: TObject);
|
||||||
|
begin
|
||||||
|
timOscilloscope.Enabled := PageControl1.ActivePage = tsOscilloscope;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.sePointerSizeChange(Sender: TObject);
|
procedure TForm1.sePointerSizeChange(Sender: TObject);
|
||||||
var
|
var
|
||||||
ls: TLineSeries;
|
ls: TLineSeries;
|
||||||
@ -162,5 +177,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.timOscilloscopeTimer(Sender: TObject);
|
||||||
|
var
|
||||||
|
rp: TChartRenderingParams;
|
||||||
|
begin
|
||||||
|
rp := chOscillator.RenderingParams;
|
||||||
|
with chOscillatorLineSeries1 do begin
|
||||||
|
Add(Sin(GetXMax / 20) + Random - 0.5);
|
||||||
|
if Count > 20 then
|
||||||
|
ListSource.Delete(0);
|
||||||
|
// Allow to zoom into various parts of the chart
|
||||||
|
// while preserving "oscilloscope" behaviour.
|
||||||
|
catOscillatorLinearAxisTransform1.Offset := -GetXMin;
|
||||||
|
end;
|
||||||
|
// Transformation change resets logical extent.
|
||||||
|
// We know the old extent is safe to keep, so restore it.
|
||||||
|
chOscillator.RenderingParams := rp;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -68,6 +68,10 @@
|
|||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Linking>
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<GenerateDebugInfo Value="True"/>
|
||||||
|
<DebugInfoType Value="dsAuto"/>
|
||||||
|
</Debugging>
|
||||||
<Options>
|
<Options>
|
||||||
<Win32>
|
<Win32>
|
||||||
<GraphicApplication Value="True"/>
|
<GraphicApplication Value="True"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user