mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 06:19:32 +02:00
TAChart: Add "Synchronize marks" control to "Independent scale" page of "axis" demo
git-svn-id: trunk@38663 -
This commit is contained in:
parent
71bbfef4d6
commit
27c22c6347
@ -34,7 +34,7 @@
|
|||||||
<RequiredPackages Count="3">
|
<RequiredPackages Count="3">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="LCLBase"/>
|
<PackageName Value="LCLBase"/>
|
||||||
<MinVersion Major="1" Valid="True" Release="1"/>
|
<MinVersion Major="1" Release="1" Valid="True"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
<Item2>
|
<Item2>
|
||||||
<PackageName Value="TAChartLazarusPkg"/>
|
<PackageName Value="TAChartLazarusPkg"/>
|
||||||
@ -54,6 +54,7 @@
|
|||||||
<Filename Value="main.pas"/>
|
<Filename Value="main.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="Form1"/>
|
<ComponentName Value="Form1"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="Main"/>
|
<UnitName Value="Main"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
|
@ -8,7 +8,7 @@ object Form1: TForm1
|
|||||||
ClientWidth = 533
|
ClientWidth = 533
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '1.1'
|
||||||
object PageControl1: TPageControl
|
object PageControl1: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 434
|
Height = 434
|
||||||
@ -117,12 +117,16 @@ object Form1: TForm1
|
|||||||
ClientWidth = 525
|
ClientWidth = 525
|
||||||
object ChartIndependent: TChart
|
object ChartIndependent: TChart
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 370
|
Height = 366
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 525
|
Width = 525
|
||||||
AxisList = <
|
AxisList = <
|
||||||
item
|
item
|
||||||
Grid.Visible = False
|
Grid.Visible = False
|
||||||
|
Intervals.Tolerance = 1
|
||||||
|
TickColor = clNavy
|
||||||
|
Marks.LabelFont.Color = clNavy
|
||||||
|
Marks.LabelFont.Style = [fsBold]
|
||||||
Minors = <>
|
Minors = <>
|
||||||
Title.LabelFont.Orientation = 900
|
Title.LabelFont.Orientation = 900
|
||||||
Transformations = catIndependent1
|
Transformations = catIndependent1
|
||||||
@ -135,7 +139,11 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
item
|
item
|
||||||
Grid.Visible = False
|
Grid.Visible = False
|
||||||
|
Intervals.Tolerance = 1
|
||||||
|
TickColor = clGreen
|
||||||
Alignment = calRight
|
Alignment = calRight
|
||||||
|
Marks.LabelFont.Color = clGreen
|
||||||
|
Marks.LabelFont.Style = [fsBold]
|
||||||
Minors = <>
|
Minors = <>
|
||||||
Transformations = catIndependent2
|
Transformations = catIndependent2
|
||||||
end>
|
end>
|
||||||
@ -163,11 +171,11 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object pnlIndependentControls: TPanel
|
object pnlIndependentControls: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 38
|
Height = 42
|
||||||
Top = 370
|
Top = 366
|
||||||
Width = 525
|
Width = 525
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
ClientHeight = 38
|
ClientHeight = 42
|
||||||
ClientWidth = 525
|
ClientWidth = 525
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object fseIndependent1: TFloatSpinEdit
|
object fseIndependent1: TFloatSpinEdit
|
||||||
@ -196,9 +204,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object lblIndependentScale1: TLabel
|
object lblIndependentScale1: TLabel
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 14
|
Height = 13
|
||||||
Top = 13
|
Top = 13
|
||||||
Width = 41
|
Width = 40
|
||||||
Caption = 'Scale 1'
|
Caption = 'Scale 1'
|
||||||
Font.Color = clNavy
|
Font.Color = clNavy
|
||||||
Font.Style = [fsBold]
|
Font.Style = [fsBold]
|
||||||
@ -207,15 +215,43 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object lblIndependentScale2: TLabel
|
object lblIndependentScale2: TLabel
|
||||||
Left = 144
|
Left = 144
|
||||||
Height = 14
|
Height = 13
|
||||||
Top = 13
|
Top = 13
|
||||||
Width = 41
|
Width = 40
|
||||||
Caption = 'Scale 2'
|
Caption = 'Scale 2'
|
||||||
Font.Color = clGreen
|
Font.Color = clGreen
|
||||||
Font.Style = [fsBold]
|
Font.Style = [fsBold]
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
ParentFont = False
|
ParentFont = False
|
||||||
end
|
end
|
||||||
|
object rgSyncAxisMarks: TRadioGroup
|
||||||
|
Left = 308
|
||||||
|
Height = 40
|
||||||
|
Top = 1
|
||||||
|
Width = 216
|
||||||
|
Align = alRight
|
||||||
|
AutoFill = True
|
||||||
|
Caption = ' Synchronize marks '
|
||||||
|
ChildSizing.LeftRightSpacing = 6
|
||||||
|
ChildSizing.TopBottomSpacing = 6
|
||||||
|
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||||
|
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||||
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
|
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||||
|
ChildSizing.ControlsPerLine = 3
|
||||||
|
ClientHeight = 22
|
||||||
|
ClientWidth = 212
|
||||||
|
Columns = 3
|
||||||
|
ItemIndex = 1
|
||||||
|
Items.Strings = (
|
||||||
|
'Left'
|
||||||
|
'None'
|
||||||
|
'Right'
|
||||||
|
)
|
||||||
|
OnClick = rgSyncAxisMarksClick
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object tsLog: TTabSheet
|
object tsLog: TTabSheet
|
||||||
@ -322,9 +358,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object lblTolerance: TLabel
|
object lblTolerance: TLabel
|
||||||
Left = 88
|
Left = 88
|
||||||
Height = 14
|
Height = 13
|
||||||
Top = 8
|
Top = 8
|
||||||
Width = 48
|
Width = 47
|
||||||
Caption = 'Tolerance'
|
Caption = 'Tolerance'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -459,9 +495,9 @@ object Form1: TForm1
|
|||||||
end
|
end
|
||||||
object lblDataCount: TLabel
|
object lblDataCount: TLabel
|
||||||
Left = 194
|
Left = 194
|
||||||
Height = 14
|
Height = 13
|
||||||
Top = 14
|
Top = 14
|
||||||
Width = 58
|
Width = 57
|
||||||
Caption = 'Data count:'
|
Caption = 'Data count:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
|
@ -5,8 +5,9 @@ unit Main;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
ComCtrls, ExtCtrls, Forms, Spin, StdCtrls, TAFuncSeries, TAGraph,
|
ComCtrls, ExtCtrls, Forms, Spin, StdCtrls, Classes,
|
||||||
TASeries, TASources, TAStyles, TATools, TATransformations, Classes;
|
TAAxisSource, TAFuncSeries, TAGraph, TASeries, TASources, TAStyles, TATools,
|
||||||
|
TATransformations;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ type
|
|||||||
pnlIndependentControls: TPanel;
|
pnlIndependentControls: TPanel;
|
||||||
pnlLogControls: TPanel;
|
pnlLogControls: TPanel;
|
||||||
pnlAutoControls: TPanel;
|
pnlAutoControls: TPanel;
|
||||||
|
rgSyncAxisMarks: TRadioGroup;
|
||||||
rcsUser: TRandomChartSource;
|
rcsUser: TRandomChartSource;
|
||||||
rcsTSummer: TRandomChartSource;
|
rcsTSummer: TRandomChartSource;
|
||||||
rcsTWinter: TRandomChartSource;
|
rcsTWinter: TRandomChartSource;
|
||||||
@ -87,8 +89,10 @@ type
|
|||||||
procedure fseIndependent1Change(Sender: TObject);
|
procedure fseIndependent1Change(Sender: TObject);
|
||||||
procedure fseIndependent2Change(Sender: TObject);
|
procedure fseIndependent2Change(Sender: TObject);
|
||||||
procedure rgRandDistrClick(Sender: TObject);
|
procedure rgRandDistrClick(Sender: TObject);
|
||||||
|
procedure rgSyncAxisMarksClick(Sender: TObject);
|
||||||
procedure seToleranceChange(Sender: TObject);
|
procedure seToleranceChange(Sender: TObject);
|
||||||
private
|
private
|
||||||
|
FAxisSource: TCustomAxisChartSource;
|
||||||
procedure FillIndependentSource;
|
procedure FillIndependentSource;
|
||||||
procedure FillCumulNormDistrSource;
|
procedure FillCumulNormDistrSource;
|
||||||
end;
|
end;
|
||||||
@ -99,7 +103,7 @@ var
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math, StrUtils, SysUtils, TAChartAxis, TAChartUtils;
|
Math, StrUtils, SysUtils, TAChartAxis, TAChartAxisUtils, TAChartUtils;
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
@ -246,6 +250,7 @@ begin
|
|||||||
FillIndependentSource;
|
FillIndependentSource;
|
||||||
FillCumulNormDistrSource;
|
FillCumulNormDistrSource;
|
||||||
seTolerance.Value := ChartLog.LeftAxis.Intervals.Tolerance;
|
seTolerance.Value := ChartLog.LeftAxis.Intervals.Tolerance;
|
||||||
|
FAxisSource := TCustomAxisChartSource.Create(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.fseIndependent1Change(Sender: TObject);
|
procedure TForm1.fseIndependent1Change(Sender: TObject);
|
||||||
@ -263,6 +268,29 @@ begin
|
|||||||
FillCumulNormDistrSource;
|
FillCumulNormDistrSource;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.rgSyncAxisMarksClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
la, ra: TChartAxis;
|
||||||
|
begin
|
||||||
|
la := ChartIndependent.LeftAxis;
|
||||||
|
ra := ChartIndependent.AxisList.GetAxisByAlign(calRight);
|
||||||
|
la.Marks.Source := nil;
|
||||||
|
ra.Marks.Source := nil;
|
||||||
|
case rgSyncAxisMarks.ItemIndex of
|
||||||
|
0: begin
|
||||||
|
FAxisSource.AxisFrom := ra;
|
||||||
|
FAxisSource.AxisTo := la;
|
||||||
|
la.Marks.Source := FAxisSource;
|
||||||
|
end;
|
||||||
|
2: begin
|
||||||
|
FAxisSource.AxisFrom := la;
|
||||||
|
FAxisSource.AxisTo := ra;
|
||||||
|
ra.Marks.Source := FAxisSource;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
la.Grid.Visible := rgSyncAxisMarks.ItemIndex <> 1;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.seToleranceChange(Sender: TObject);
|
procedure TForm1.seToleranceChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ChartLog.LeftAxis.Intervals.Tolerance := seTolerance.Value;
|
ChartLog.LeftAxis.Intervals.Tolerance := seTolerance.Value;
|
||||||
|
Loading…
Reference in New Issue
Block a user