How to use Spline with Period and PeriodStyle properties ??

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
swesty
Newbie
Newbie
Posts: 14
Joined: Tue Feb 17, 2009 12:00 am

How to use Spline with Period and PeriodStyle properties ??

Post by swesty » Wed Jun 09, 2010 5:22 am

Hello Steema,

I have a query regarding how to set the period of a Spline function. At the moment I am doing the following but I only get 28 points even though I have set Period to 5000 and PeriodStyle to psNumPoints. Any clues would be great.
The reason I am asking is that I previously asked how to find the y value at a set x value and that works nicely. However in this instance the added points I am using are only able to generate 28 points within the splineseries. Is that normal ?
I have specified that I want 500 but only ever get 28 maximum. I have tried PeriodStyle of psRange as well but it doesn't make any difference either.

Here is the code I am using

Code: Select all

 
    LabNoIndex := 1 ;
    RValuePointSeries[LabNoIndex] := TPointSeries.Create(Self) ;
    RValuePointSeries[LabNoIndex].VertAxis := aRightAxis ;
    [b]SplineFunction := TSmoothingFunction.Create(self) ;
    SplineFunction.PeriodStyle := psNumPoints ;
    SplineFunction.Period :=  400 ;
    SplineFunction.Interpolate := checkbox1.checked ;
    SplineFunction.Factor := 9 ;
    SplineSeries[LabNoIndex] := TLineSeries.Create(Self) ;
    SplineSeries[LabNoIndex].LinePen.Color := clBlack ;
    SplineSeries[LabNoIndex].LinePen.Width := 2 ;
    SplineSeries[LabNoIndex].SeriesColor := clBlack ;

    SplineSeries[LabNoIndex].SetFunction(Splinefunction) ;
    SplineSeries[LabNoIndex].VertAxis := aRightAxis ;
    if LabNoIndex = 1 then
    begin
      Chart1.AddSeries(RValuePointSeries[LabNoIndex]) ;
      Chart1.AddSeries(SplineSeries[LabNoindex]) ;
    end;

    RValueLineSeries[LabNoIndex] := TLineSeries.Create(Self) ;

    Screen.Cursor := CrDefault ;
    RValuePointSeries[LabNoIndex].Pointer.HorizSize := 3 ;
    RValuePointSeries[LabNoIndex].Pointer.VertSize := 3 ;
    RValuePointSeries[LabNoIndex].Pointer.Style := psDiagCross ;
    j := 0 ;


    RValuePointSeries[LabNoIndex].AddXY(453,75,'',clBlue) ;
    RValuePointSeries[LabNoIndex].AddXY(255,64,'',clBlue) ;
    RValuePointSeries[LabNoIndex].AddXY(215,60,'',clBlue) ;

     SplineSeries[LabNoIndex].DataSource := RValuePointSeries[LabNoIndex] ;
     SplineSeries[LabnoIndex].checkDataSource ;

     XPeak := 300 ;

     Showmessage(inttostr(SplineSeries[LabNoIndex].Count)) ;
     for i := 0 to SplineSeries[LabNoIndex].Count-1 do
     begin
       if SplineSeries[LabNoIndex].XValues[i] = XPeak then
        YPeak := SplineSeries[LabNoIndex].YValues[i] ;
     end;
     EstOMC[LabNoIndex] := XPeak ;
     EstMDD[LabNoIndex] := YPeak ;

Thank you,

Steve West

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to use Spline with Period and PeriodStyle properties ??

Post by Yeray » Wed Jun 09, 2010 3:17 pm

Hi Steve West,

I think that incrementing the SplineFunction.Factor gives the result you are finding. Isn't it?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

swesty
Newbie
Newbie
Posts: 14
Joined: Tue Feb 17, 2009 12:00 am

Re: How to use Spline with Period and PeriodStyle properties ??

Post by swesty » Wed Jun 09, 2010 9:43 pm

Yeray,

Thank you for the reply. Usually the most obvious things are the hardest to see!!
I have tried this and I can only ever get a maximum value of 601 points regardless of factor so I am assuming that must be some internal maximum ?
For example if I have 3 points and set factor to 1000 and 2000 I only see a maximum number of values created at 601. Would this be correct ?
Thanks again and I can actually live with this however just asking if there is some internal maximum.

Kind Regards,
Steve West

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How to use Spline with Period and PeriodStyle properties ??

Post by Yeray » Fri Jun 11, 2010 9:12 am

Hi Steve,

Yes, there is a MaxFragments = 600, if you are source code customer you'll be able to change it to what you want.
The Fragments is the result of the operation Sources.Count * Factor.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply