TAChart: Remove DataSeries from FitDemo (FitSeries can display data points by itself now).

git-svn-id: trunk@54236 -
This commit is contained in:
wp 2017-02-21 19:09:15 +00:00
parent 0e70e5588a
commit c4bbb8fbea
3 changed files with 19 additions and 34 deletions

View File

@ -2,13 +2,13 @@ object frmMain: TfrmMain
Left = 249 Left = 249
Height = 503 Height = 503
Top = 242 Top = 242
Width = 800 Width = 839
Caption = 'frmMain' Caption = 'frmMain'
ClientHeight = 503 ClientHeight = 503
ClientWidth = 800 ClientWidth = 839
OnCreate = FormCreate OnCreate = FormCreate
ShowHint = True ShowHint = True
LCLVersion = '1.5' LCLVersion = '1.7'
object pnlParams: TPanel object pnlParams: TPanel
Left = 8 Left = 8
Height = 487 Height = 487
@ -89,7 +89,7 @@ object frmMain: TfrmMain
Left = 14 Left = 14
Height = 15 Height = 15
Top = 12 Top = 12
Width = 70 Width = 69
Caption = 'Test function' Caption = 'Test function'
ParentColor = False ParentColor = False
end end
@ -274,18 +274,18 @@ object frmMain: TfrmMain
Left = 392 Left = 392
Height = 487 Height = 487
Top = 8 Top = 8
Width = 400 Width = 439
Align = alClient Align = alClient
BorderSpacing.Around = 8 BorderSpacing.Around = 8
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 487 ClientHeight = 487
ClientWidth = 400 ClientWidth = 439
TabOrder = 1 TabOrder = 1
object Chart: TChart object Chart: TChart
Left = 0 Left = 0
Height = 456 Height = 456
Top = 0 Top = 0
Width = 400 Width = 439
AxisList = < AxisList = <
item item
Grid.Visible = False Grid.Visible = False
@ -327,37 +327,26 @@ object frmMain: TfrmMain
) )
Align = alClient Align = alClient
DoubleBuffered = True DoubleBuffered = True
object DataSeries: TLineSeries
Title = 'Test data'
AxisIndexX = 1
AxisIndexY = 0
LinePen.Style = psClear
Pointer.Brush.Color = clBlack
Pointer.HorizSize = 1
Pointer.Style = psCross
Pointer.VertSize = 1
ShowPoints = True
Source = ListChartSource
end
object FitSeries: TFitSeries object FitSeries: TFitSeries
Legend.Format = '%0:s: %2:s' Legend.Format = '%0:s: %2:s'
Title = 'fitted data' Title = 'fitted data'
AxisIndexX = 1 AxisIndexX = 1
AxisIndexY = 0 AxisIndexY = 0
OnFitComplete = FitCompleteHandler
Pen.Color = clRed Pen.Color = clRed
Pointer.Style = psCross
Source = ListChartSource Source = ListChartSource
OnFitComplete = FitCompleteHandler
end end
end end
object pnlLog: TPanel object pnlLog: TPanel
Left = 0 Left = 0
Height = 31 Height = 31
Top = 456 Top = 456
Width = 400 Width = 439
Align = alBottom Align = alBottom
BevelOuter = bvNone BevelOuter = bvNone
ClientHeight = 31 ClientHeight = 31
ClientWidth = 400 ClientWidth = 439
TabOrder = 1 TabOrder = 1
object cbLogX: TCheckBox object cbLogX: TCheckBox
Left = 48 Left = 48

View File

@ -6,8 +6,8 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, Spin, Buttons, TAGraph, TASeries, TASources, StdCtrls, Spin, Buttons,
TAFuncSeries, TATransformations; TAGraph, TASources, TAFuncSeries, TATransformations;
type type
@ -18,7 +18,6 @@ type
Chart: TChart; Chart: TChart;
cbDrawFitRangeOnly: TCheckBox; cbDrawFitRangeOnly: TCheckBox;
FitSeries: TFitSeries; FitSeries: TFitSeries;
DataSeries: TLineSeries;
cbFitRangeUseMin:TCheckBox; cbFitRangeUseMin:TCheckBox;
cbFitRangeUseMax:TCheckBox; cbFitRangeUseMax:TCheckBox;
cbFitEquation: TComboBox; cbFitEquation: TComboBox;
@ -199,21 +198,21 @@ begin
ymin := MinValue(yarr); ymin := MinValue(yarr);
ymax := MaxValue(yarr); ymax := MaxValue(yarr);
maxNoise := edNoiseY.Value * (ymax - ymin) * 0.01; maxNoise := edNoiseY.Value * (ymax - ymin) * 0.01;
DataSeries.BeginUpdate; FitSeries.BeginUpdate;
try try
DataSeries.Clear; FitSeries.Clear;
for i := 0 to High(xarr) do begin for i := 0 to High(xarr) do begin
x := xarr[i]; x := xarr[i];
y := yarr[i] + maxNoise * (Random - 0.5); y := yarr[i] + maxNoise * (Random - 0.5);
if TFitEquation(cbTestFunction.ItemIndex) = feExp then if TFitEquation(cbTestFunction.ItemIndex) = feExp then
// Make sure that the noise generation does not produce negative // Make sure that the noise generation does not produce negative
// values for the exponential data set. // values for the exponential data set.
while y < 0 do while y <= 0 do
y := yarr[i] + maxNoise * (Random - 0.5); y := yarr[i] + maxNoise * (Random - 0.5);
DataSeries.AddXY(x, y); FitSeries.AddXY(x, y);
end; end;
finally finally
DataSeries.EndUpdate; FitSeries.EndUpdate;
end; end;
end; end;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="10"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
@ -13,9 +13,6 @@
<i18n> <i18n>
<EnableI18N LFM="False"/> <EnableI18N LFM="False"/>
</i18n> </i18n>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>