Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Cursors on Graph

I have a CWGraph control (Strip Chart) with 3 plots and 3 cursors(Major X & Major Y, Point on Selected plot) I plot and buffer thousands of data points and use CWGraph1.TrackMode = cwGTrackPanPlotAreaX to pan back and forth through the data. When I want to use the cursors I set CWGraph1.TrackMode = cwGTrackDragCursor. The problem is that the cursors are always at the start of the plot. Is there anyway I can keep the cursors centered in my graph while I am plotting data and also when I set  CWGraph1.TrackMode = cwGTrackPanPlotAreaX  and have the cursors act normal when I set CWGraph1.TrackMode = cwGTrackDragCursor?
 
Also, My customer has requested that I find a way to pan back and forth through the graph data using cursor or function keys. Is this possible? I also write software for disabled individuals and this would be a great feature for them.
 
Thank you,
Bob Hiller
0 Kudos
Message 1 of 6
(7,246 Views)
DelphiBob -
 
Could you expand a little more on what you would like the cursors to do?  I am a little confused on what you mean by normal behavior.
 
I've been taking a look at the CWGraph Cursors example for reference.  In this example, the two cursors are given initial x and y values.  I can actively move the cursors to whatever location I would like.  When I turn TrackMode to cwGTrackPanPlotAreaX, and then back to GTrackDragCursor, the cursors remain in the same postion.  In other words, setting the Trackmode had no bearing on the CWGraph.Cursors(#).XPosition and YPosition properties.
 
As I understand your problem now, you can always set the CWGraph.Cursors(#).XPosition and YPosition just before setting the trackmode to cwGTrackDragCursor.  When the cursors appear, they will be in the value pairs that you specify.
 
Have a great day!
 
Andrew W || Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(7,227 Views)
Thanks, I was missing the ability to set the cursor positions.
 
In Reference to:
Also, My customer has requested that I find a way to pan back and forth through the graph data using cursor or function keys. Is this possible? I also write software for disabled individuals and this would be a great feature for them.
 
Do you have a solution?
 
Thank you,
Bob Hiller
0 Kudos
Message 3 of 6
(7,225 Views)

I spoke too soon. Sure the cursors can be positioned using code such as

CWGraph1.Cursors(1).XPosition = 1000
CWGraph1.Cursors(1).YPosition = 1000

However this does not come close to what I asked. I will try again

3 plots, 3 cursors, Graph is Stripchart. Chart History 10000

plot 10000 points on each plot.

cursors by default will be in the lower left corner of the graph.

I use this to show my Y value

Private Sub CWGraph1_CursorChange(CursorIndex As Long, XPos As Variant, YPos As Variant, bTracking As Boolean)
    CWGraph1.Annotations(CursorIndex).Caption.XCoordinate = XPos + 200 'XIncrement
    CWGraph1.Annotations(CursorIndex).Caption.YCoordinate = YPos + 20
    CWGraph1.Annotations(CursorIndex).Caption.Text = YPos
End Sub

NOW, set CWGraph1.TrackMode = cwGTrackPanPlotAreaX, pan ahead with your mouse.

NOW, CWGraph1.TrackMode = cwGTrackDragCursor

Where are the Cursors? They are invisible because they panned out of view when you just panned the graph.

I need to know how to get the Cursors back to the lower left corner of the Graph where they started.

The sample I started with is CwGraph_with_Annotated_Cursors.zip

 

We are about to purchase your latest version of Measurement Studio but at this point I think it would be a waste of money!

Thank you,

 

 

 

 

 

 

 

0 Kudos
Message 4 of 6
(7,216 Views)

Bob,

 

Here is a code snippet that returns the one cursor to the bottom left of the screen, and the other to the middle (I used this code after all panning and zooming was completed, and I wanted to go back to cwTrackDragCursor):

            CWGraph1.TrackMode = cwGTrackDragCursor
            CWGraph1.Cursors(1).XPosition = (CWGraph1.Axes(1).Minimum)
            CWGraph1.Cursors(1).YPosition = (CWGraph1.Axes(2).Minimum)
            CWGraph1.Cursors(2).XPosition = (CWGraph1.Axes(1).Minimum + CWGraph1.Axes(1).Maximum) / 2
            CWGraph1.Cursors(2).YPosition = (CWGraph1.Axes(2).Minimum + CWGraph1.Axes(2).Maximum) / 2

I will need to look into using cursors for doing pan/zooming.  I'll get back to you on that one.

Have a good day!

Andrew W

National Insruments

0 Kudos
Message 5 of 6
(7,211 Views)
I just want to make sure that you understand that I mean panning using the cursor keys on the keyboard not cursors on the graph control.
 
Bob
0 Kudos
Message 6 of 6
(7,212 Views)