Simple drag point example with VB .NET

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Yacu
Newbie
Newbie
Posts: 31
Joined: Tue Dec 23, 2008 12:00 am

Simple drag point example with VB .NET

Post by Yacu » Wed Oct 26, 2011 3:09 pm

I am reprogramming an old application in which you could drag points. I have not found anything similar to the code I was using -which I include below these lines. Could you provide a snippet on VB .NET similar to it together with other functions useful for dragging point and getting info for them?

Thanks a lot

Private Sub Tchart1_OnDragPointToolDragPoint(ByVal Index As Long)
Tchart1.ToolTipText = Format(Tchart1.Series(0).XValues.Value(Index), "dd/mm/yyyy hh:nn") & " " & _
Format(Tchart1.Series(0).YValues.Value(Index), "#,###,##0.000")
End Sub

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Simple drag point example with VB .NET

Post by Sandra » Thu Oct 27, 2011 1:05 pm

Hello Yacu,

I have made a simple example where I have gotten the values of Series in the Event Drag of DragPoint Tool and I recommend you try to do something as next:

Code: Select all

Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()
        InitializeChart()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Private dragpoint As Steema.TeeChart.Tools.DragPoint
    Private series1 As Steema.TeeChart.Styles.Points
    Private Sub InitializeChart()
        series1 = New Points(TChart1.Chart)

        Dim rnd As New Random()
        Dim data As DateTime = DateTime.Now
        Dim day As TimeSpan = TimeSpan.FromDays(1)
        series1.XValues.DateTime = True
        For i As Integer = 0 To 9
            series1.Add(data, rnd.[Next](100))

            data += day
        Next
        TChart1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.TwoDays)
        dragpoint = New Steema.TeeChart.Tools.DragPoint(TChart1.Chart)
        AddHandler dragpoint.Drag, AddressOf dragpoint_Drag
    End Sub

    Private Sub dragpoint_Drag(ByVal sender As Steema.TeeChart.Tools.DragPoint, ByVal index As Integer)
        Me.Text = "XValues:" & DateTime.FromOADate(series1.XValues(index)).ToShortDateString() & ",YValues: " & series1.YValues(index).ToString()

    End Sub
Can you tell us if previous code works as you expected?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply