TAChart: Update axis demo to include auto-scaling

git-svn-id: trunk@26928 -
This commit is contained in:
ask 2010-07-31 10:14:43 +00:00
parent 275ed478aa
commit 91ae387e7a
2 changed files with 47 additions and 4 deletions

View File

@ -24,7 +24,7 @@ object Form1: TForm1
ClientWidth = 525
object ChartT: TChart
Left = 0
Height = 307
Height = 278
Top = 0
Width = 525
AxisList = <
@ -40,6 +40,7 @@ object Form1: TForm1
Title.Caption = 'Summer temperature, °C'
Title.Font.Color = clRed
Title.Font.Orientation = 900
Transformations = catTAuto
end
item
Alignment = calBottom
@ -72,6 +73,7 @@ object Form1: TForm1
Align = alClient
ParentColor = False
object ChartTSummer: TLineSeries
AxisIndexY = 0
LinePen.Color = clRed
LinePen.Width = 2
SeriesColor = clRed
@ -92,6 +94,25 @@ object Form1: TForm1
Source = rcsTWinter
end
end
object pnlAutoControls: TPanel
Left = 0
Height = 29
Top = 278
Width = 525
Align = alBottom
ClientHeight = 29
ClientWidth = 525
TabOrder = 1
object cbAuto: TCheckBox
Left = 4
Height = 17
Top = 5
Width = 70
Caption = 'Auto scale'
OnChange = cbAutoChange
TabOrder = 0
end
end
end
object tsLog: TTabSheet
Caption = 'Logarithm transform'
@ -255,10 +276,13 @@ object Form1: TForm1
object catT: TChartAxisTransformations
left = 352
top = 60
object catTCelToFahr: TLinearAxisTransform
object catTFahrToCel: TLinearAxisTransform
Offset = -17.777777777
Scale = 0.5555555555
end
object catTAutoScaleAxisTransform1: TAutoScaleAxisTransform
Enabled = False
end
end
object rcsTSummer: TRandomChartSource
PointsNumber = 20
@ -280,4 +304,11 @@ object Form1: TForm1
left = 87
top = 156
end
object catTAuto: TChartAxisTransformations
left = 352
top = 112
object catTAutoAutoScaleAxisTransform1: TAutoScaleAxisTransform
Enabled = False
end
end
end

View File

@ -6,13 +6,17 @@ interface
uses
ComCtrls, ExtCtrls, Forms, StdCtrls, TAGraph, TASeries, TASources,
TATransformations;
TATransformations, Classes;
type
{ TForm1 }
TForm1 = class(TForm)
catTAutoAutoScaleAxisTransform1: TAutoScaleAxisTransform;
catTAutoScaleAxisTransform1: TAutoScaleAxisTransform;
catTAuto: TChartAxisTransformations;
cbAuto: TCheckBox;
ChartLog: TChart;
cfsLog: TFuncSeries;
cbLog: TCheckBox;
@ -23,7 +27,7 @@ type
ChartAxisTransformations1LinearAxisTransform2: TLinearAxisTransform;
ChartAxisTransformations1LogarithmAxisTransform1: TLogarithmAxisTransform;
catT: TChartAxisTransformations;
catTCelToFahr: TLinearAxisTransform;
catTFahrToCel: TLinearAxisTransform;
ChartCustomMarks: TChart;
ChartCustomMarksBarSeries1: TBarSeries;
ChartTSummer: TLineSeries;
@ -31,11 +35,13 @@ type
lcsMarks: TListChartSource;
PageControl1: TPageControl;
pnlLogControls: TPanel;
pnlAutoControls: TPanel;
rcsTSummer: TRandomChartSource;
rcsTWinter: TRandomChartSource;
lsLinear: TTabSheet;
tsLog: TTabSheet;
tsCustomMarks: TTabSheet;
procedure cbAutoChange(Sender: TObject);
procedure cbLogChange(Sender: TObject);
procedure ChartLogFuncSeries1Calculate(const AX: Double; out AY: Double);
procedure FormCreate(Sender: TObject);
@ -59,6 +65,12 @@ end;
{ TForm1 }
procedure TForm1.cbAutoChange(Sender: TObject);
begin
catTAutoAutoScaleAxisTransform1.Enabled := cbAuto.Checked;
catTAutoScaleAxisTransform1.Enabled := cbAuto.Checked;
end;
procedure TForm1.cbLogChange(Sender: TObject);
begin
ChartAxisTransformations1LogarithmAxisTransform1.Enabled := cbLog.Checked;