08-25-2006 10:02 AM
08-28-2006 09:07 AM
08-28-2006 11:53 AM
08-28-2006
02:30 PM
- last edited on
08-04-2025
09:23 AM
by
Content Cleaner
It is quite a bit different in VB6 (I apologize, I instantly switched into .NET mode), but there is an excellent example for VB6 hosted on ni.com at Creating Annotated Cursors with the Measurement Studio Graph in Visual Basic.
The commands in the function CWGraph1_CursorChange will work the same for X vs Y Plots.
Matt Mueller
National Instruments
08-28-2006 02:37 PM
08-28-2006 08:38 PM
08-29-2006
10:01 AM
- last edited on
08-04-2025
09:23 AM
by
Content Cleaner
Havey,
Is there a specific property or properties you have a question about? There are quite a few annotation properties that can be edited in Visual Basic - more than we have space for here.
In the example I linked to above you can explore the properties yourself by simply adding a new line referencing the annotation and hitting the period (.) to cause the function assistance box to appear (So type "CWGraph1.Annotations(CursorIndex)." to make the function box appear in the example above). Editing an annotation's properties (and a property's properties) is as easy as following the this simple step and seeing what is suggested.
If you just have questions about using VB and Measurement Studio, you could always check out out Measurement Studio for Visual Basic Support area or you could simply search NI.com for whatever topics you need (like, Visual Basic Annotation).
Matt Mueller
National Instruments
04-11-2007 09:16 AM
Hi,
I have a similar problem using the CWGraph in visual basic 6.
I'd like to snap minmaxregions to my plot. I would like the annotation to react just like a cursor. That would mean if I set the region.xcoordinates at some values they would automatically snap to the nearest plot's values.
I cannot seem to get this to work, since if I set the annotation snap mode to "pointonanyplot" or such, the region starts to neglect the shape's xcoordinates and starts using the point index as a reference.
This is also explained in the help:
If you set SnapMode to cwCSnapFloating, the shape is drawn at the values specified by CWShape.XCoordinates and CWShape.YCoordinates, and you can move the entire annotation anywhere in the graph area. If you set SnapMode to cwCSnapPointsOnPlot, the shape is centered around the plot point defined by the Plot and PointIndex properties, and you can move the shape along the plot.
Now I don't want it to center, yet I'd like to give the starting and endposition of the region and make sure it snaps too (thus I can not use cwSnapFloating). Is there a way to achieve this?
Thanks
04-12-2007 04:17 PM
04-13-2007 02:41 AM - edited 04-13-2007 02:41 AM
I've seen the example before, yet I'm affraid it's not a solution for my problem.
I'll try to be more specific.
I don't have (nor specifically want) any cursors, I have a cwGraph with a plot. Now I want to highlight a part of the plot by draging the mouse horizontally on the plot. The "selection" has to snap (dynamically) to the values on the plot.
I handle this by updating a minmax region-annotation shape's xcoordinates.
This xcoordinates property of the shape have to snap to the plot-values.
I use the plot's mousedown and mousemove events to determin the initial start/end positions (Xpos) of the mouse, and I pass these values to the annotation's xcoordinates property, thus updating the highlight on the fly.
Now if the shape is "floating" the shape draws fine, yet it's not snapping to the values. If I make the shape snapping to pointsonanyplot however the shape starts acting in this "pointindex mode" (as I refer to it for now) as I wrote before, which is an unwantend different behaviour.
Is there a way to make the shape snap both it's xcoordinates to the plot instead of switching to this "pointindex-mode"?
Thanks
Message Edited by Michanovich on 04-13-2007 02:43 AM
Message Edited by Michanovich on 04-13-2007 02:43 AM