Page 1 of 1

spline values

Posted: Wed Apr 07, 2004 6:11 am
by 6924590
Dear Steema

TChartt V6 has a spline smoothing capability. Is it possible to have acces to the smoothed spline value at a given location, i.e. x value? In other words is it possible to get y = f(x), where f is the spline function, x the given location and y the smootehed value? This could be very uesful.

regards

Andras

Posted: Wed Apr 07, 2004 2:19 pm
by Chris
Hi Andras,
TChartt V6 has a spline smoothing capability. Is it possible to have acces to the smoothed spline value at a given location, i.e. x value? In other words is it possible to get y = f(x), where f is the spline function, x the given location and y the smootehed value? This could be very uesful.
This information can't be obtained directly from the Smoothing Function itself at the moment but can be obtained indirectly, e.g.

Code: Select all

Private Sub Form_Load()
With TChart1
    .AddSeries scPoint
    .AddSeries scLine
    
    .Aspect.View3D = False
    .Series(0).FillSampleValues 20
    
    .Series(1).SetFunction tfSmoothing
    .Series(1).DataSource = .Series(0)
    .Series(1).CheckDataSource
    
    .Tools.Add tcCursor
    .Tools.Items(0).asTeeCursor.FollowMouse = True
    .Tools.Items(0).asTeeCursor.Style = cssVertical
   
End With
End Sub

Private Sub TChart1_OnCursorToolChange(ByVal Tool As Long, ByVal X As Long, ByVal Y As Long, ByVal XVal As Double, ByVal YVal As Double, ByVal Series As Long, ByVal ValueIndex As Long)
Dim aspWidth As Integer
Dim yValue1 As Double
Dim xValue1 As Double
With TChart1
    For i = .Axis.Left.CalcYPosValue(.Series(1).YValues.Maximum) - aspWidth To .Axis.Left.CalcYPosValue(.Series(1).YValues.Minimum) - aspWidth
        If .Series(1).Clicked(X, i) <> -1 Then
            yValue1 = .Axis.Left.CalcPosPoint(i)
            xValue1 = .Axis.Bottom.CalcPosPoint(X)
            Label1.Caption = "XValue: " & xValue1 & "  YValue: " & yValue1
        End If
    Next i
End With
End Sub