How to use Spline with Period and PeriodStyle properties ??
Posted: 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
Thank you,
Steve West
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