Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Any examples of using cursors and cursor events with Measurement Studio 7.0 Scattergraphs?

Measurement Studio 7.0 with VB.NET
0 Kudos
Message 1 of 5
(6,406 Views)
There are not any examples like this in the current version of Measurement Studio. What are you trying to do with the cursors and cursor events? Please provide more information about what you're looking for and we can post some sample code. Thanks.

- Elton
0 Kudos
Message 2 of 5
(6,406 Views)
Hello Elton,
Primarily I would like to get the cursor X and Y positions on a cursor move event. I know how to get the cursor positions but I do not know how to write the cursor (after move) event procedure.

Steve
0 Kudos
Message 3 of 5
(6,406 Views)
OK, here's an quick example. Create a new Windows Forms application and add a ScatterGraph and a Label to the form. Add a cursor to the ScatterGraph, then add the code below to the form. This generates 50 random data points when the form is loaded and plots them, then uses the cursor's AfterMove event to display the current X and Y positions in the label. Here's the code:

Private Sub OnFormLoad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Const dataLength As Integer = 50
Dim xData(dataLength - 1) As Double
Dim yData(dataLength - 1) As Double

Dim rnd As Random = New Random
For i As Integer = 0 To dataLength - 1
xData(i) = i
yData(i) = rnd.NextDouble() * 10

Next

ScatterGraph1.PlotXY(xData, yData)
End Sub

Private Sub OnAfterMoveXYCursor(ByVal sender As Object, ByVal e As NationalInstruments.UI.AfterMoveXYCursorEventArgs) Handles XyCursor1.AfterMove
Label1.Text = String.Format("({0}, {1})", e.XPosition, e.YPosition)
End Sub

Hope this helps.

- Elton
0 Kudos
Message 4 of 5
(6,406 Views)
Thanks Elton. You saved me a lot of time and aggravation. I'm still getting use to the new graph controls. Seems like the cursor snap modes are not as versatile as the cwgraph. Maybe it's just the learning curve but it is difficult to find good examples as you have provided.

Steve
0 Kudos
Message 5 of 5
(6,406 Views)