spline values

TeeChart for ActiveX, COM and ASP
Post Reply
Andras
Newbie
Newbie
Posts: 8
Joined: Mon Jul 08, 2002 4:00 am
Location: Hungary

spline values

Post by Andras » Wed Apr 07, 2004 6:11 am

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

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Apr 07, 2004 2:19 pm

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
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply