如何使用TeeChart生成这样的图表?

时间:2013-07-14 16:31:11

标签: delphi teechart

使用最后粘贴的数据点,我得到一个使用TeeChart的图表,如下图所示(第二张图片)。但是,我想得到的是如第一张图像(黑线)所示。我想知道怎么做?任何评论(关于如何做或关于算法)都赞赏!

通过GaussView(红外光谱)

gaussview-1

by TeeChart

teechart-1

数据

   11.25   0.8558
   13.93   0.7101
   17.49   1.7783
   18.48   0.0972
   20.91   0.7608
   23.36   2.0540
   27.87   1.7063
   31.34   0.4998
   32.45   0.8735
   36.86   1.9740
   37.68   1.1448
   39.02   1.6381
   39.64   2.4984
   40.63   2.5854
   43.90   1.9891
   45.38   1.0168
   46.85   3.4588
   50.19   0.5997
   51.69   3.0986
   52.37   5.2783
   54.35   1.3672
   55.93   1.9774
   58.26   1.4327
   60.00   0.1276
   62.18   0.1294
   64.04   2.5145
   66.10   7.5823
   68.48   0.4689
   70.60   3.5168
   72.22   6.7262
   73.78   2.9225
   76.05   1.6195
   77.39   2.9711
   79.05   3.0244
   79.51   7.5896
   81.41   4.4896
   83.34   4.7092
   85.55   5.7364
   91.65   9.5119
   93.06   4.1190
   95.26   0.5367
   97.60   1.7773
   99.59   4.0967
   100.29   3.3551
   102.68   2.9290
   104.37   2.1907
   105.86   3.1003
   108.29   4.6200
   108.83   1.6020
   112.74   4.5426
   113.61   5.8697
   115.43   5.3545
   116.92   7.5064
   118.52   1.1735
   121.26   3.2800
   123.70   0.7140
   125.51   12.3312
   126.79   0.6539
   129.59   1.6488
   130.17   3.3001
   133.15   5.4448
   133.81   5.2958
   135.57   0.7273
   136.74   2.7725
   138.48   7.9547
   140.74   4.4754
   143.16   4.1672
   145.21   2.0647
   147.25   6.0894
   150.77   6.6854
   153.96   0.2456
   154.71   5.2882
   157.72   3.3148
   159.83   41.1787
   160.94   3.3881
   164.82   21.6722
   167.02   25.2616
   168.56   5.3165
   172.00   6.9968
   174.48   3.4963
   175.31   3.6395
   177.35   1.3092
   180.03   6.7443
   181.92   2.3712
   185.01   1.8564
   186.79   8.2453
   188.59   11.1710
   191.39   2.9369
   196.44   5.2397
   197.33   6.8805
   199.89   15.0378
   201.45   4.7054
   203.79   13.3486
   207.10   5.7904
   209.25   11.0755
   211.85   23.5711
   213.68   17.2254
   214.61   3.9448
   217.47   34.9757
   220.06   5.1604
   220.74   3.7671
   225.87   13.0953
   229.77   8.4948
   233.98   21.1654
   237.24   17.6599
   238.71   25.2668
   239.34   15.7494
   244.56   43.4527
   246.16   36.9053
   248.17   7.5639
   251.21   8.0873
   253.46   4.3431
   255.42   5.9059
   256.73   1.7785
   260.22   14.1219
   260.70   4.8738
   265.07   10.0827
   267.08   4.9080
   268.50   11.9286
   271.89   8.8873
   274.01   29.4943
   275.04   29.2369
   277.04   52.4743
   278.13   14.3284
   281.82   3.3507
   284.56   21.7815
   288.79   8.5983
   290.67   30.2466
   294.11   10.9149
   301.49   7.3059
   302.30   67.0245
   302.84   6.5049
   305.51   0.2989
   311.16   4.8017
   316.45   16.0656
   320.37   42.8200
   325.45   36.8340
   336.19   35.0153
   338.45   18.0032
   339.63   3.6068
   340.62   5.0152
   348.49   77.5149
   352.39   84.1067
   358.46   16.2392
   364.34   56.0846
   371.03   78.4101
   378.71   50.3951
   381.68   79.3127
   391.26   10.3953
   394.69   75.6727
   397.38   50.5976
   399.97   40.0959
   405.64   23.4627
   417.96   12.1802
   419.47   21.9191
   429.40   1.9362
   431.84   10.8746
   437.11   6.7498
   439.38   42.1917
   454.11   18.9428
   459.08   41.1182
   465.76   50.9344
   467.25   27.1854
   475.56   130.5899
   481.25   72.5219
   487.87   25.8915
   489.15   5.5288
   489.42   124.2637
   497.37   167.8169
   501.23   6.7103
   502.49   9.7129
   508.77   26.4849
   520.56   9.5302
   522.17   2.9284
   523.54   124.3465
   524.98   79.0902
   528.27   53.1656
   533.88   12.9278
   536.31   203.4675
   540.72   33.9929
   543.41   142.5774
   550.07   37.2596
   557.93   168.8374
   560.52   60.4300
   562.84   36.1606
   566.10   151.7689
   567.79   66.6189
   572.38   149.8744
   576.57   79.9780
   585.50   112.8536
   586.51   95.4084
   597.52   3.5723
   600.64   60.4112
   603.83   147.9974
   604.41   29.0763
   606.39   7.1134
   609.57   6.2102
   611.10   7.8785
   612.84   162.3687
   620.43   170.4984
   625.49   160.0876
   630.37   36.9260
   638.97   40.4913
   646.00   25.4423
   646.05   17.5637
   652.18   23.6302
   653.87   45.4506
   655.96   31.1678
   657.95   43.5278
   666.44   17.7154
   668.63   78.3033
   674.15   20.1193
   675.43   28.3611
   679.85   99.0228
   684.13   62.2844
   685.09   36.8384
   686.88   44.9261
   688.54   86.4601
   690.35   23.8856
   691.64   245.3722
   699.16   120.5513
   709.26   2.6988
   723.74   332.8580
   726.74   6.5182
   728.74   165.1788
   730.46   5.6564
   738.13   13.5268
   740.13   12.5284
   742.74   113.7637
   752.67   23.3185
   753.85   50.6479
   754.67   2.4454
   771.93   6.8897
   775.45   195.5114
   777.97   60.3044
   782.04   1.5514
   784.40   28.3898
   785.12   127.7568
   787.49   6.4007
   795.51   7.3133
   799.34   201.9055
   802.14   19.5573
   818.55   382.3869
   819.71   6.5877
   822.96   14.2146
   824.05   2.2121
   826.46   111.9575
   830.73   29.2754
   831.01   24.9736
   834.71   22.8259
   844.08   59.8333
   845.62   40.3083
   850.76   135.1998
   856.03   2.2111
   858.83   5.4722
   860.88   228.0665
   867.35   122.4081
   875.07   5.8894
   877.33   74.5747
   881.75   28.0580
   884.49   4.7371
   887.88   27.9916
   888.41   81.4206
   895.50   18.5746
   906.14   37.3150
   909.57   39.2727
   909.89   13.8018
   912.76   3.8752
   916.27   0.2486
   926.60   12.7987
   926.73   10.4374
   929.15   131.5315
   931.10   2.9229
   934.57   113.7453
   942.69   91.3771
   948.15   25.1075
   951.93   33.4258
   954.69   44.6893
   964.15   1.5994
   965.00   0.7321
   972.10   8.4069
   973.43   7.5676
   979.59   10.5092
   981.39   30.0315
   983.34   157.9592
   987.12   24.8756
   995.21   81.4163
   995.60   22.9050
   996.60   18.5511
   997.58   41.7678
   1001.40   7.2941
   1010.63   3.7654
   1017.41   12.3927
   1020.10   1.2928
   1020.50   6.4156
   1027.74   3.5186
   1029.51   15.7644
   1032.33   4.9588
   1038.71   4.4052
   1042.08   3.1957
   1042.54   23.7493
   1044.90   0.6490
   1051.57   9.5923
   1058.97   6.4381
   1072.38   13.5097
   1075.43   1.4965
   1076.01   16.5798
   1079.15   0.7097
   1082.69   163.1472
   1085.62   11.4565
   1090.04   9.5450
   1104.35   0.4181
   1105.81   19.4965
   1107.07   1.4116
   1107.32   2.1959
   1107.51   0.8469
   1109.85   16.5227
   1116.34   3.7611
   1117.27   22.3061
   1122.22   5.0637
   1123.85   2.0819
   1126.87   99.5244
   1127.27   0.7508
   1129.03   7.9063
   1131.13   12.5686
   1136.06   2.4318
   1138.90   11.9482
   1139.10   0.9399
   1146.32   3.3872
   1159.39   11.9471
   1161.78   14.1617
   1174.95   23.2351
   1179.72   14.9091
   1189.14   3.7741
   1204.68   17.3601
   1205.62   25.2461
   1214.86   38.4565
   1222.25   4.7630
   1222.40   15.9294
   1222.83   12.4804
   1229.30   17.8518
   1248.53   23.6590
   1252.67   56.1945
   1257.42   8.6184
   1261.43   8.7950
   1261.70   4.7045
   1265.78   16.4704
   1267.68   4.8315
   1273.64   1.5993
   1273.80   83.2365
   1275.45   18.8720
   1284.93   0.8743
   1286.10   12.7644
   1286.41   38.1346
   1291.55   238.9537
   1299.52   27.7401
   1302.81   21.4327
   1312.97   7.2615
   1316.40   37.1928
   1319.76   32.1009
   1321.66   43.8679
   1323.22   11.7175
   1324.58   0.5651
   1330.94   16.7787
   1332.59   16.8946
   1337.01   3.1987
   1338.49   12.1263
   1340.41   31.1700
   1345.84   13.8655
   1346.50   0.9794
   1349.54   14.2011
   1357.85   45.9726
   1358.09   3.9610
   1362.71   5.3914
   1366.21   16.9550
   1372.10   64.1772
   1374.92   161.5665
   1380.58   230.3131
   1384.00   328.5477
   1385.04   5.1667
   1390.07   0.1589
   1397.37   40.3024
   1397.88   5.2971
   1398.44   3.5395
   1401.91   22.7442
   1403.68   0.8136
   1404.50   30.1834
   1407.30   62.3116
   1407.42   3.0998
   1410.47   17.7966
   1411.88   14.4825
   1414.12   10.3780
   1418.49   8.3303
   1419.19   17.0070
   1419.62   3.6385
   1419.71   19.0577
   1422.55   6.9579
   1423.39   1.0293
   1431.35   333.3874
   1436.26   307.7709
   1440.15   41.7923
   1441.39   536.8224
   1443.14   252.0576
   1445.99   216.7363
   1449.43   128.0188
   1462.98   11.9692
   1467.30   28.3347
   1473.56   23.1465
   1475.93   42.4514
   1483.98   36.0277
   1484.24   5.2501
   1484.39   24.3948
   1485.45   10.8186
   1490.44   11.5231
   1492.27   7.3633
   1495.11   8.5312
   1495.56   18.0179
   1497.77   3.1224
   1497.88   14.2399
   1498.31   3.0918
   1499.72   5.7379
   1501.76   26.4984
   1504.98   13.7143
   1507.61   1.4629
   1508.28   8.4327
   1508.41   4.8958
   1508.48   4.2296
   1512.21   8.4668
   1515.46   1.8979
   1518.07   20.2652
   1518.82   9.2094
   1521.34   9.8395
   1526.17   2.9542
   1526.43   9.4439
   1528.02   3.3756
   1528.30   2.4509
   1532.78   5.3007
   1534.13   6.5043
   1537.24   53.5120
   1540.81   1.9113
   1543.85   4.4977
   1544.20   4.2213
   1548.35   3.6878
   1552.54   14.8614
   1559.24   11.6988
   1564.07   74.1574
   1566.46   108.9087
   1567.58   6.3844
   1575.43   2.5287
   1577.84   233.8768
   1595.41   237.2607
   1596.87   369.0431
   1616.23   173.9335
   1624.09   836.9518
   1626.98   233.4742
   1628.60   5.4746
   1632.35   100.3850
   1637.82   390.7923
   1643.65   382.0132
   1676.36   174.8716
   1677.37   240.7762
   1681.68   71.5960
   1686.63   207.9686
   1689.79   321.4797
   1706.91   270.6300
   1710.36   276.3541
   1719.02   103.4710
   1722.09   13.0707
   1732.52   118.1263
   1733.45   134.7822
   1737.38   86.6398
   1741.65   193.3777
   1745.96   267.6557
   1748.85   104.5308
   1750.11   84.3295
   1754.89   142.1761
   1762.19   44.6467
   1778.03   277.3395
   1786.51   54.7132
   1801.43   124.4060
   2501.45   2817.4313
   2892.60   1433.0563
   3010.32   37.5543
   3018.83   24.9084
   3020.63   4.2749
   3026.82   31.0382
   3027.83   7.3210
   3028.25   21.5317
   3034.03   19.3657
   3042.31   18.5627
   3042.36   29.6968
   3045.35   18.7716
   3047.91   13.3663
   3050.76   6.5443
   3053.48   25.7608
   3055.29   40.7227
   3055.58   28.5712
   3055.88   7.9362
   3057.54   10.2078
   3059.36   27.4736
   3059.83   26.5108
   3059.85   22.3488
   3061.56   4.6525
   3063.51   25.9303
   3065.41   14.8583
   3066.43   25.5202
   3066.83   40.4775
   3068.42   6.6192
   3068.55   27.7206
   3069.66   5.1897
   3074.54   30.3667
   3077.72   1.0555
   3082.30   19.8899
   3085.29   277.0890
   3086.03   7.4622
   3086.91   55.7138
   3090.29   9.7699
   3090.42   23.7039
   3098.95   15.2559
   3100.15   37.0280
   3101.05   12.4841
   3104.13   31.3489
   3104.26   305.3252
   3107.27   14.1801
   3107.65   8.3824
   3111.25   23.7250
   3113.32   1.6109
   3116.84   31.4006
   3118.15   8.3440
   3123.33   5.3227
   3127.86   7.6340
   3129.01   7.9926
   3132.66   10.0175
   3138.18   348.0472
   3138.83   3.9995
   3145.04   497.0629
   3165.17   3.9671
   3168.85   798.7276
   3200.74   837.1487
   3204.12   38.9204
   3206.21   21.6877
   3206.27   39.0288
   3206.94   34.9876
   3212.51   37.8135
   3212.92   20.7165
   3226.37   15.2672
   3281.65   23.1858
   3282.58   732.5195
   3283.15   78.0229
   3283.92   991.2039
   3287.78   41.3881
   3290.37   28.2757
   3290.38   7.2058
   3292.55   27.3318
   3294.23   639.1337
   3297.11   79.7924
   3316.31   8.5916
   3322.30   531.3133
   3334.75   1463.9099
   3351.13   264.7960
   3360.34   535.8013
   3364.82   26.2667
   3366.49   742.5906
   3384.37   544.7382
   3400.63   6.4281
   3402.60   899.7517
   3453.29   481.2669
   3470.55   778.0064
   3473.31   615.6872
   3500.34   437.9592
   3529.86   128.6586
   3558.92   229.6075
   3574.77   105.5502
   3612.50   690.1041
   3614.15   29.7018
   3616.71   175.4585
   3624.01   42.5718
   3641.96   104.2644
   3672.04   421.7865
   3678.61   67.3033
   3687.01   73.1667
   3714.16   231.0432
   3740.14   63.1046
   3757.45   102.1256
   3763.15   124.6488
   3779.08   64.7553
   3791.33   34.4075

2 个答案:

答案 0 :(得分:3)

引用您的数据来源:

 1801.43   124.4060
 2501.45   2817.4313

2501.45   2817.4313
2892.60   1433.0563

2892.60   1433.0563
3010.32   37.5543

TeeChart正确呈现给定数据。 。
如果您想更改数据 - 和图表 - 您应该添加错过的数据点。

您需要决定添加计数的频率(通过哪些X步骤)。从y-zero开始的delta意味着取消传播(因为你眼中的差异变得微不足道)。

然后你要制作一个多项式公式,确定每个峰值相对于峰值绝对值的下降速度。像y == y0 / (a*(x-x0)^4 + b*(x-x0)^2 + c)或类似的东西。你应该尝试这一点,最后得到适合你口味的系数和功率。

然后围绕每个峰值(也称为主要源数据点),您应该添加这些次要的计算点,直到它们非常接近y-zero或者直到它们满足来自相邻数据点的次要值,这将首先发生

你可以推导出一个公式,其中两个传播波将会变成肉,这取决于y0y1abs(x0-x1),或者你只是懒惰并从两个方向计算完整路径然后插入最大y值。

这个次要的,增强的系列,你会传递给TeaChart,它会显示你喜欢的。

PS。看看mitov.com - 他的免费组件很少,但也许会有一些合适的东西......

PPS。非常粗略的草案,用于丰富数据http://pastebin.com/JtaqkAkS 应该手动调整估计函数和配置以获得最佳结果,无论“最佳”和#34;会的。

答案 1 :(得分:3)

正如TLama非常友好地建议的那样,解决方案是单独发布的:

[解决]

这些图之间的差异是由于洛伦兹线展宽。见Spectra line in Wikipedia。非常感谢您的所有评论!一个非常基本的工作示例如下:

unit uCurvFit;

interface

uses
  uRtlTypes,
  Math, SysUtils;

type

  TLineShapeFitFunc = (lsffLorentz, lsffGauss);

  TLineShapeFit = function(const RelOffset: Double): Double;

function Lorentz(const RelOffset: Double): Double;
function Gauss(const RelOffset: Double): Double;

procedure SpectrumFit(const OriginalFrequencies, OriginalIntensities
  : TADouble; LineShapeFitFunc: TLineShapeFitFunc; var NFreqs: Integer;
  var NewFrequencies: TADouble; var NewIntensities: TADouble);

implementation

function Lorentz(const RelOffset: Double): Double;
begin
  Result := 1.0 / (1.0 + RelOffset * RelOffset);
end;

function Gauss(const RelOffset: Double): Double;
const
  nln2: Double = -0.301029996; // - Log10(2.0);
begin
  Result := Exp(nln2 * RelOffset * RelOffset);
end;

procedure SpectrumFit(const OriginalFrequencies, OriginalIntensities
  : TADouble; LineShapeFitFunc: TLineShapeFitFunc; var NFreqs: Integer;
  var NewFrequencies: TADouble; var NewIntensities: TADouble);
const
  FrequencyStep: Double = 1.0;
  HwHm: Double = 20.0; // Full Width at Half Maximum
var
  I, J: Integer;
  MaxFreq, MinFreq: Double;

  Intensity, Freq, Center, RelOffset: Double;
  LineShapeFit: TLineShapeFit;
begin
  MaxFreq := 4000;
  MinFreq := 0;

  for I := 0 to Length(OriginalFrequencies) do
  begin
    if MaxFreq < OriginalFrequencies[I] then
      MaxFreq := OriginalFrequencies[I];

    if MinFreq > OriginalFrequencies[I] then
      MinFreq := OriginalFrequencies[I];
  end;

  case LineShapeFitFunc of
    lsffLorentz:
      LineShapeFit := Lorentz;
    lsffGauss:
      LineShapeFit := Gauss;
  end;

  NFreqs := 1 + Trunc((MaxFreq - MinFreq) / FrequencyStep);
  SetLength(NewFrequencies, NFreqs);
  SetLength(NewIntensities, NFreqs);

  for I := 0 to NFreqs - 1 do
  begin
    Intensity := 0.0;
    Freq := MinFreq + I * FrequencyStep;

    for J := 0 to Length(OriginalFrequencies) - 1 do
    begin
      Center := OriginalFrequencies[J];
      RelOffset := (Freq - Center) / HwHm;
      Intensity := Intensity + OriginalIntensities[J] * LineShapeFit(RelOffset);
    end;

    NewFrequencies[I] := Freq;
    NewIntensities[I] := Intensity;
  end;
end;

end.