05-13-2009 03:38 PM
Hi I am trying to use the CWgraph to display Data coming from Serial com port but there is no luck . I was using the mschart1 that comes with VB6 and every thing is working fine , but since they need to acquire 3 hours test , i would prefer to use Measurement studio.
i will attch my code , Hope you can help me guys.
P.S : I am using VB6 with M-studio v 2.1
Solved! Go to Solution.
05-14-2009 06:09 PM
kmous,
What happens when you try and run this code? I tried running it and just got a flat line, but I don't have anything hooked up to my serial port. Is that what you see?
05-15-2009 09:02 AM
I think I found the trick , but i am going to get back to you ASAP , I am gonna test it at the lab where the hardware is and let you know what;s happening 🙂
Question : is there a way that i can fix the X axes(time) 0 to 60 seconds and then the plot line keeps going from left to right to see the display data for 1 hour at least ? so that i can scroll back to any time i want ?
05-18-2009 11:34 AM
05-18-2009 04:15 PM
Hi Eric , Thx for the help 🙂 during my research i found out that i cannot Zoom back out on 2d Graph ? is that right ? I know i can use the Zoomrect xy with undo but is this a good way to do it ?
2- it works fine with my hardware , i can get the data i want , but i still get a line at 0 of my array Data once i push Connect it is like it is there by default 😞 , how can i get rid of this ? i dunno why it is diplaying that line !!! my array Data takes the data from .input and calls my Methods !!! so it should display only my data that comes from my hardware , I am sure it is something with the Array Data.
05-19-2009 10:28 AM
kmous,
Yes, to zoom out on the 2d graph, you want to set the TrackMode to TrackZoomRectXYWithUndo so you can undo the zoom. That is the best way to essentially zoom out. For your code, you may want to add a check in your timer code to check for valid data before you plot it so you're not plotting the inital 0s before you get your data. Maybe set some sort of boolean flag as soon as you receive data that is not 0 (rather than throwing out all 0s so you can still plot 0s later if you get them)
05-20-2009 07:57 AM
For the Plotting thing , i made a for loop in the timer to check if my Data(i) =0 or not , if it is 0 in all array then , i dont display the Data 🙂 works fine.
None of the zoom funtions works 😞 , I did enable trackmodeallevents in usercontrol_initialize() whcich is right.
Private Sub UserControl_Initialize()
CWGraph1.Axes(1).SetMinMax 1, 60 ' reset X axis
CWGraph1.Axes(2).SetMinMax -20, 40
CWGraph1.TrackMode = cwGTrackAllEvents
Call ShowAvailablePorts
End Sub
see attached.
05-21-2009 11:45 AM
05-21-2009 12:20 PM
UMM I had to do that with my programming , it works but it disabled the cursor position one , i ll figure out a way to deal with. (i thought that i could change that on the Graph property page).
Is there a way or maybe a mouse event that let me do the following :
I want to include in my excel file where the data is saved a Marker or flag or any thing that can tell me i pressed my mouse at time 40 on my plot.
example , during the test , if i click on a point on my plot , i want my excel file to remenber that i pressed that point at that specific value and time , u know what i mean ?
thank you
05-22-2009 11:17 AM