diff --git a/components/tachart/demo/axistransf/axistransfdemo.lpi b/components/tachart/demo/axistransf/axistransfdemo.lpi index 9594fcb4b8..40280e8963 100644 --- a/components/tachart/demo/axistransf/axistransfdemo.lpi +++ b/components/tachart/demo/axistransf/axistransfdemo.lpi @@ -34,7 +34,7 @@ - + @@ -54,6 +54,7 @@ + diff --git a/components/tachart/demo/axistransf/main.lfm b/components/tachart/demo/axistransf/main.lfm index 0ca044af80..c29f9a6840 100644 --- a/components/tachart/demo/axistransf/main.lfm +++ b/components/tachart/demo/axistransf/main.lfm @@ -8,7 +8,7 @@ object Form1: TForm1 ClientWidth = 533 OnCreate = FormCreate Position = poScreenCenter - LCLVersion = '0.9.31' + LCLVersion = '1.1' object PageControl1: TPageControl Left = 0 Height = 434 @@ -117,12 +117,16 @@ object Form1: TForm1 ClientWidth = 525 object ChartIndependent: TChart Left = 0 - Height = 370 + Height = 366 Top = 0 Width = 525 AxisList = < item Grid.Visible = False + Intervals.Tolerance = 1 + TickColor = clNavy + Marks.LabelFont.Color = clNavy + Marks.LabelFont.Style = [fsBold] Minors = <> Title.LabelFont.Orientation = 900 Transformations = catIndependent1 @@ -135,7 +139,11 @@ object Form1: TForm1 end item Grid.Visible = False + Intervals.Tolerance = 1 + TickColor = clGreen Alignment = calRight + Marks.LabelFont.Color = clGreen + Marks.LabelFont.Style = [fsBold] Minors = <> Transformations = catIndependent2 end> @@ -163,11 +171,11 @@ object Form1: TForm1 end object pnlIndependentControls: TPanel Left = 0 - Height = 38 - Top = 370 + Height = 42 + Top = 366 Width = 525 Align = alBottom - ClientHeight = 38 + ClientHeight = 42 ClientWidth = 525 TabOrder = 1 object fseIndependent1: TFloatSpinEdit @@ -196,9 +204,9 @@ object Form1: TForm1 end object lblIndependentScale1: TLabel Left = 16 - Height = 14 + Height = 13 Top = 13 - Width = 41 + Width = 40 Caption = 'Scale 1' Font.Color = clNavy Font.Style = [fsBold] @@ -207,15 +215,43 @@ object Form1: TForm1 end object lblIndependentScale2: TLabel Left = 144 - Height = 14 + Height = 13 Top = 13 - Width = 41 + Width = 40 Caption = 'Scale 2' Font.Color = clGreen Font.Style = [fsBold] ParentColor = False ParentFont = False 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 object tsLog: TTabSheet @@ -322,9 +358,9 @@ object Form1: TForm1 end object lblTolerance: TLabel Left = 88 - Height = 14 + Height = 13 Top = 8 - Width = 48 + Width = 47 Caption = 'Tolerance' ParentColor = False end @@ -459,9 +495,9 @@ object Form1: TForm1 end object lblDataCount: TLabel Left = 194 - Height = 14 + Height = 13 Top = 14 - Width = 58 + Width = 57 Caption = 'Data count:' ParentColor = False end diff --git a/components/tachart/demo/axistransf/main.pas b/components/tachart/demo/axistransf/main.pas index 36e02222ff..b88e82ca0a 100644 --- a/components/tachart/demo/axistransf/main.pas +++ b/components/tachart/demo/axistransf/main.pas @@ -5,8 +5,9 @@ unit Main; interface uses - ComCtrls, ExtCtrls, Forms, Spin, StdCtrls, TAFuncSeries, TAGraph, - TASeries, TASources, TAStyles, TATools, TATransformations, Classes; + ComCtrls, ExtCtrls, Forms, Spin, StdCtrls, Classes, + TAAxisSource, TAFuncSeries, TAGraph, TASeries, TASources, TAStyles, TATools, + TATransformations; type @@ -65,6 +66,7 @@ type pnlIndependentControls: TPanel; pnlLogControls: TPanel; pnlAutoControls: TPanel; + rgSyncAxisMarks: TRadioGroup; rcsUser: TRandomChartSource; rcsTSummer: TRandomChartSource; rcsTWinter: TRandomChartSource; @@ -87,8 +89,10 @@ type procedure fseIndependent1Change(Sender: TObject); procedure fseIndependent2Change(Sender: TObject); procedure rgRandDistrClick(Sender: TObject); + procedure rgSyncAxisMarksClick(Sender: TObject); procedure seToleranceChange(Sender: TObject); private + FAxisSource: TCustomAxisChartSource; procedure FillIndependentSource; procedure FillCumulNormDistrSource; end; @@ -99,7 +103,7 @@ var implementation uses - Math, StrUtils, SysUtils, TAChartAxis, TAChartUtils; + Math, StrUtils, SysUtils, TAChartAxis, TAChartAxisUtils, TAChartUtils; {$R *.lfm} @@ -246,6 +250,7 @@ begin FillIndependentSource; FillCumulNormDistrSource; seTolerance.Value := ChartLog.LeftAxis.Intervals.Tolerance; + FAxisSource := TCustomAxisChartSource.Create(Self); end; procedure TForm1.fseIndependent1Change(Sender: TObject); @@ -263,6 +268,29 @@ begin FillCumulNormDistrSource; 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); begin ChartLog.LeftAxis.Intervals.Tolerance := seTolerance.Value;