hii all
yet another question from me..
i have written a code in vb6 to call a labview7.1 vi and run it. the labview code acquires data and plots the data continuously as long as the program is running. now i want this graph to be plotted on vb6 form.
any ideas how i can do it?
thanks.
Shefali 0 Light Poster
Comatose 290 Taboo Programmer Team Colleague
Eak, does labview write a .txt file, or some means in which VB can read the data?
Shefali 0 Light Poster
yea labview can write a text file or excel data file.
Comatose 290 Taboo Programmer Team Colleague
Then, if you can past an example of that file.... I can see about how to go about reading it. What I'm guessing you'll have to do, is have labview write a file (either one, text or excel, vb can work with both) and then get a list of points out of that file, and plot them using pset or something.....
Shefali 0 Light Poster
ok i got ur point.
in that case i wud like, as the labview program wud continuously add/save data to a excel/text file... vb wud continously read this file and plot the graph in its form or mschart control or whatever is suitable.
now i dont think i know how to do it. i guess i can use some array and save some data points in it and keepon updating that. i m not sure though. can u give me any example of plotting realtime graph in vb?
the excel/text file have 3 columns first one time, 2nd column depth and the third is distance. now depth and distance needs to be plotted in y axis and time in x axis.
the data file can be really large.
Shefali 0 Light Poster
guys... can u plz give me some ideas about this real time plotting thing.
i have a text/excel data file where data is being continously added. i want to plot this data wrt time on a vb form.
i m stuck.. plz help me. thanks.
Comatose 290 Taboo Programmer Team Colleague
Is the textfile constantly being "ADDED" to, or is it constantly being UPDATED (there is a difference, ya know... added to means that it leaves the data alone that's already in the file, and just adds more data to the end, while updated means that it's possibly changing the data already in the file)
Shefali 0 Light Poster
no its just adding the data..
Comatose 290 Taboo Programmer Team Colleague
So, what you'll need to do, is open the text file, and read in the data. Keep a count of how many lines there are. Then, in a loop, read any added data (any lines greater than the last read) and plot them. Do this over and over until the file is done updating, and you should be good to go. Something to keep in mind, is that file is going to get big probably, so... you may want to check it's size every so often, and if it reaches a certain size, delete the file, and reset your count. I don't know what kind of effect that's going to have on labview though..... it might get pretty pissed about you deleting the file.....
Is it necessary to actually have the VB app plot the data, or would having the VB app kidnap the graph area work?
Shefali 0 Light Poster
well i have checked with labview and found that labview doesnt allow vb to get its graph. that is the graph object of labview isnt accessible to vb.
i understand what u said abt the vb coding stuff... but can u give me some similar example code.. it seems to me pretty daunting (for my capabilities).
thanks.
Comatose 290 Taboo Programmer Team Colleague
You'll need to post the text file (a portion of it) so I know the format we are dealing with.....
FYI: I wasn't talking about asking for their permission. I was actually talking about taking it..... without permission. So that Labview would still be running, and it would still be plotting the things to the graph, but the graph would be kidnapped into the VB form.
Shefali 0 Light Poster
ok i will post the data file.. just give me a few mins.
and regarding the kidnap thing.. that was exactly my idea to begin with... but cudnt find a way to do it. if that cud have been done.. wow.. all probs solved.
Comatose 290 Taboo Programmer Team Colleague
First, you'll need to get the class name of that window.... I have a program that does this: http://www.aftermath.net/~coma/downloads/getclass/getclass.zip, once you download and install that, run the "Getclass" program, and it will show you a textbox and a button. The textbox will contain the windows current hWnd (The number assigned to it by windows), The class name of the window, The caption (title) of the window, and it's thread id. The only crucial one that we need is the Class, but if it has a caption, then both would be even better. So, once you are running the program, hold your mouse over the graph, and write down the class name (and caption if applicable) and post it here..... then we'll write code to do it.
Shefali 0 Light Poster
here is the text file. the values are seperated by comma. the first data is date and isnt needed. now the second is time of measurement and the rests are some measurement value. new data will be added continously to this file. now i need to plot the 3 data after the time (ie in fisrt row: 4.8, 135 and 6.2) i dont need the last data for plotting.
if needed the time of measurement can include seconds as well so that there wudnt be multiple data for a single time.
labview can also save the data as excel file.
The attachment preview is chopped off after the first 10 KB. Please download the entire file.
3/14/2006,1:27 PM,4.8,135,6.2,139
3/14/2006,1:27 PM,4.8,140,6.2,139
3/14/2006,1:27 PM,4.8,144,6.2,139
3/14/2006,1:27 PM,4.8,149,6.2,139
3/14/2006,1:27 PM,4.0,154,6.2,139
3/14/2006,1:27 PM,4.5,159,6.2,139
3/14/2006,1:27 PM,4.5,163,6.2,138
3/14/2006,1:27 PM,4.5,168,6.2,138
3/14/2006,1:27 PM,4.8,173,6.2,138
3/14/2006,1:27 PM,4.0,177,6.2,138
3/14/2006,1:27 PM,4.8,182,6.2,138
3/14/2006,1:27 PM,4.8,187,6.2,138
3/14/2006,1:27 PM,4.8,191,6.2,138
3/14/2006,1:27 PM,4.8,196,6.2,138
3/14/2006,1:27 PM,4.0,201,6.2,138
3/14/2006,1:27 PM,4.8,206,6.2,138
3/14/2006,1:27 PM,4.8,210,6.2,138
3/14/2006,1:27 PM,4.8,215,6.2,138
3/14/2006,1:27 PM,4.8,220,6.2,138
3/14/2006,1:27 PM,4.8,225,6.2,138
3/14/2006,1:27 PM,4.0,229,6.2,138
3/14/2006,1:27 PM,4.0,234,6.2,137
3/14/2006,1:27 PM,4.8,239,6.2,137
3/14/2006,1:27 PM,4.8,244,6.2,137
3/14/2006,1:27 PM,4.8,248,6.2,137
3/14/2006,1:27 PM,4.8,253,6.2,137
3/14/2006,1:27 PM,4.8,257,6.2,137
3/14/2006,1:27 PM,4.8,262,6.3,137
3/14/2006,1:27 PM,4.8,267,6.2,137
3/14/2006,1:27 PM,4.0,272,6.2,137
3/14/2006,1:27 PM,4.5,276,6.2,137
3/14/2006,1:27 PM,4.5,281,6.2,137
3/14/2006,1:27 PM,4.8,286,6.2,137
3/14/2006,1:27 PM,4.8,290,6.2,137
3/14/2006,1:27 PM,4.8,296,6.2,137
3/14/2006,1:27 PM,4.8,300,6.2,137
3/14/2006,1:27 PM,4.8,305,6.2,137
3/14/2006,1:27 PM,4.0,309,6.2,136
3/14/2006,1:27 PM,4.0,314,6.2,136
3/14/2006,1:27 PM,4.0,319,6.2,136
3/14/2006,1:27 PM,4.0,324,6.2,136
3/14/2006,1:27 PM,4.0,328,6.2,136
3/14/2006,1:27 PM,4.0,333,6.2,136
3/14/2006,1:28 PM,4.0,337,6.2,136
3/14/2006,1:28 PM,4.0,343,6.2,136
3/14/2006,1:28 PM,4.0,347,6.2,136
3/14/2006,1:28 PM,4.0,352,6.2,136
3/14/2006,1:28 PM,4.0,356,6.2,136
3/14/2006,1:28 PM,4.0,362,6.2,136
3/14/2006,1:28 PM,4.0,366,6.2,136
3/14/2006,1:28 PM,4.0,371,6.2,136
3/14/2006,1:28 PM,4.0,375,6.2,136
3/14/2006,1:28 PM,4.0,380,6.2,136
3/14/2006,1:28 PM,4.0,385,6.2,135
3/14/2006,1:28 PM,4.0,390,6.2,135
3/14/2006,1:28 PM,4.0,394,6.2,135
3/14/2006,1:28 PM,4.0,399,6.2,135
3/14/2006,1:28 PM,4.0,403,6.2,135
3/14/2006,1:28 PM,4.0,409,6.2,135
3/14/2006,1:28 PM,4.0,413,6.2,135
3/14/2006,1:28 PM,4.0,418,6.2,135
3/14/2006,1:28 PM,4.0,422,6.3,135
3/14/2006,1:28 PM,4.0,427,6.2,135
3/14/2006,1:28 PM,4.0,432,6.2,135
3/14/2006,1:28 PM,4.0,437,6.2,135
3/14/2006,1:28 PM,4.0,441,6.2,135
3/14/2006,1:28 PM,4.0,446,6.2,135
3/14/2006,1:28 PM,4.0,451,6.2,135
3/14/2006,1:28 PM,4.0,456,6.2,135
3/14/2006,1:28 PM,4.0,460,6.2,134
3/14/2006,1:28 PM,4.0,465,6.2,134
3/14/2006,1:28 PM,4.0,469,6.2,134
3/14/2006,1:28 PM,4.0,475,6.2,134
3/14/2006,1:28 PM,4.0,479,6.2,134
3/14/2006,1:28 PM,4.0,484,6.2,134
3/14/2006,1:28 PM,4.0,488,6.2,134
3/14/2006,1:28 PM,4.0,493,6.2,134
3/14/2006,1:28 PM,4.0,498,6.2,134
3/14/2006,1:28 PM,4.0,503,6.2,134
3/14/2006,1:28 PM,4.0,508,6.2,134
3/14/2006,1:28 PM,4.0,512,6.2,134
3/14/2006,1:28 PM,4.0,517,6.2,134
3/14/2006,1:28 PM,4.0,522,6.2,134
3/14/2006,1:28 PM,4.0,527,6.2,134
3/14/2006,1:28 PM,4.0,531,6.2,134
3/14/2006,1:28 PM,4.0,536,6.2,134
3/14/2006,1:28 PM,4.0,540,6.2,133
3/14/2006,1:28 PM,4.0,545,6.2,133
3/14/2006,1:28 PM,4.0,550,6.2,133
3/14/2006,1:28 PM,4.0,555,6.2,133
3/14/2006,1:28 PM,4.0,559,6.3,133
3/14/2006,1:28 PM,4.0,564,6.3,133
3/14/2006,1:28 PM,4.0,569,6.3,133
3/14/2006,1:28 PM,4.0,574,6.3,133
3/14/2006,1:28 PM,4.0,578,6.3,133
3/14/2006,1:28 PM,4.0,583,6.3,133
3/14/2006,1:28 PM,4.0,588,6.3,133
3/14/2006,1:28 PM,4.0,593,6.3,133
3/14/2006,1:28 PM,4.0,597,6.3,133
3/14/2006,1:28 PM,4.0,602,6.3,133
3/14/2006,1:28 PM,4.0,606,6.3,133
3/14/2006,1:28 PM,4.0,612,6.3,133
3/14/2006,1:28 PM,4.0,616,6.3,133
3/14/2006,1:29 PM,4.0,621,6.3,132
3/14/2006,1:29 PM,4.0,625,6.3,132
3/14/2006,1:29 PM,4.0,630,6.3,132
3/14/2006,1:29 PM,4.0,635,6.3,132
3/14/2006,1:29 PM,4.0,640,6.3,132
3/14/2006,1:29 PM,4.0,644,6.3,132
3/14/2006,1:29 PM,4.0,649,6.3,132
3/14/2006,1:29 PM,4.0,654,6.3,132
3/14/2006,1:29 PM,4.0,659,6.3,132
3/14/2006,1:29 PM,4.0,663,6.3,132
3/14/2006,1:29 PM,4.0,668,6.2,132
3/14/2006,1:29 PM,4.0,672,6.3,132
3/14/2006,1:29 PM,4.0,678,6.3,132
3/14/2006,1:29 PM,4.0,682,6.3,132
3/14/2006,1:29 PM,4.0,687,6.3,132
3/14/2006,1:29 PM,4.0,691,6.3,132
3/14/2006,1:29 PM,4.0,696,6.3,132
3/14/2006,1:29 PM,4.0,701,6.3,132
3/14/2006,1:29 PM,4.0,706,6.3,131
3/14/2006,1:29 PM,4.0,710,6.3,131
3/14/2006,1:29 PM,4.0,715,6.3,131
3/14/2006,1:29 PM,4.0,720,6.3,131
3/14/2006,1:29 PM,4.0,725,6.3,131
3/14/2006,1:29 PM,4.0,729,6.3,131
3/14/2006,1:29 PM,4.0,734,6.3,131
3/14/2006,1:29 PM,4.0,739,6.3,131
3/14/2006,1:29 PM,4.8,743,6.3,131
3/14/2006,1:29 PM,4.0,748,6.3,131
3/14/2006,1:29 PM,4.0,753,6.3,131
3/14/2006,1:29 PM,4.8,757,6.3,131
3/14/2006,1:29 PM,4.0,762,6.3,131
3/14/2006,1:29 PM,4.0,767,6.3,131
3/14/2006,1:29 PM,4.0,772,6.3,131
3/14/2006,1:29 PM,4.0,776,6.3,131
3/14/2006,1:29 PM,4.0,781,6.3,131
3/14/2006,1:29 PM,4.0,786,6.3,131
3/14/2006,1:29 PM,4.0,791,6.3,131
3/14/2006,1:29 PM,4.0,796,6.3,131
3/14/2006,1:29 PM,4.0,800,6.3,130
3/14/2006,1:29 PM,4.0,805,6.3,130
3/14/2006,1:29 PM,4.0,809,6.3,130
3/14/2006,1:29 PM,4.0,815,6.3,130
3/14/2006,1:29 PM,4.0,819,6.3,130
3/14/2006,1:29 PM,4.0,824,6.3,130
3/14/2006,1:29 PM,4.0,828,6.3,130
3/14/2006,1:29 PM,4.0,833,6.3,130
3/14/2006,1:29 PM,4.0,838,6.3,130
3/14/2006,1:29 PM,4.0,843,6.3,130
3/14/2006,1:29 PM,4.0,847,6.3,130
3/14/2006,1:29 PM,4.0,852,6.3,130
3/14/2006,1:29 PM,4.0,857,6.3,130
3/14/2006,1:29 PM,4.0,862,6.3,130
3/14/2006,1:29 PM,4.0,866,6.3,130
3/14/2006,1:29 PM,4.0,871,6.3,130
3/14/2006,1:29 PM,4.0,876,6.3,130
3/14/2006,1:29 PM,4.0,881,6.3,130
3/14/2006,1:29 PM,4.0,885,6.3,130
3/14/2006,1:29 PM,4.0,890,6.3,130
3/14/2006,1:29 PM,4.0,894,6.3,130
3/14/2006,1:29 PM,4.0,899,6.3,130
3/14/2006,1:30 PM,4.0,904,6.3,130
3/14/2006,1:30 PM,4.0,909,6.3,129
3/14/2006,1:30 PM,4.0,913,6.3,129
3/14/2006,1:30 PM,4.0,918,6.3,129
3/14/2006,1:30 PM,4.0,923,6.3,129
3/14/2006,1:30 PM,4.0,928,6.3,129
3/14/2006,1:30 PM,4.0,932,6.3,129
3/14/2006,1:30 PM,4.0,937,6.3,129
3/14/2006,1:30 PM,4.0,941,6.3,129
3/14/2006,1:30 PM,4.0,947,6.3,129
3/14/2006,1:30 PM,4.0,951,6.3,129
3/14/2006,1:30 PM,4.0,956,6.3,129
3/14/2006,1:30 PM,4.0,960,6.3,129
3/14/2006,1:30 PM,4.0,965,6.3,129
3/14/2006,1:30 PM,4.0,970,6.3,129
3/14/2006,1:30 PM,4.0,975,6.3,129
3/14/2006,1:30 PM,4.0,979,6.3,129
3/14/2006,1:30 PM,4.0,984,6.3,129
3/14/2006,1:30 PM,4.0,989,6.3,129
3/14/2006,1:30 PM,4.0,994,6.3,129
3/14/2006,1:30 PM,4.0,999,6.3,129
3/14/2006,1:30 PM,4.0,1003,6.3,129
3/14/2006,1:30 PM,4.0,1008,6.3,129
3/14/2006,1:30 PM,4.0,1012,6.3,129
3/14/2006,1:30 PM,4.0,1017,6.3,129
3/14/2006,1:30 PM,4.0,1022,6.3,129
3/14/2006,1:30 PM,4.0,1027,6.3,129
3/14/2006,1:30 PM,4.0,1031,6.3,129
3/14/2006,1:30 PM,4.0,1036,6.3,129
3/14/2006,1:30 PM,4.0,1041,6.3,129
3/14/2006,1:30 PM,4.0,1045,6.3,129
3/14/2006,1:30 PM,4.0,1050,6.3,129
3/14/2006,1:30 PM,4.0,1055,6.3,129
3/14/2006,1:30 PM,4.0,1060,6.3,129
3/14/2006,1:30 PM,4.0,1065,6.3,129
3/14/2006,1:30 PM,4.0,1069,6.3,129
3/14/2006,1:30 PM,4.0,1074,6.3,128
3/14/2006,1:30 PM,4.0,1078,6.3,128
3/14/2006,1:30 PM,4.0,1084,6.3,128
3/14/2006,1:30 PM,4.0,1088,6.3,128
3/14/2006,1:30 PM,4.0,1093,6.3,128
3/14/2006,1:30 PM,4.0,1097,6.3,128
3/14/2006,1:30 PM,4.0,1102,6.3,128
3/14/2006,1:30 PM,4.0,1107,6.3,128
3/14/2006,1:30 PM,4.0,1112,6.3,128
3/14/2006,1:30 PM,4.0,1116,6.3,128
3/14/2006,1:30 PM,4.0,1121,6.3,128
3/14/2006,1:30 PM,4.0,1125,6.3,128
3/14/2006,1:30 PM,4.0,1131,6.3,128
3/14/2006,1:30 PM,4.0,1135,6.3,128
3/14/2006,1:30 PM,4.0,1140,6.3,128
3/14/2006,1:30 PM,4.0,1144,6.3,128
3/14/2006,1:30 PM,4.0,1150,6.3,128
3/14/2006,1:30 PM,4.0,1154,6.3,128
3/14/2006,1:30 PM,4.0,1159,6.3,128
3/14/2006,1:30 PM,4.0,1164,6.3,128
3/14/2006,1:30 PM,4.0,1168,6.3,128
3/14/2006,1:30 PM,4.0,1173,6.3,128
3/14/2006,1:30 PM,4.0,1178,6.3,128
3/14/2006,1:30 PM,4.0,1183,6.3,128
3/14/2006,1:31 PM,4.0,1187,6.3,128
3/14/2006,1:31 PM,4.0,1192,6.3,128
3/14/2006,1:31 PM,4.0,1197,6.3,128
3/14/2006,1:31 PM,3.4,1201,6.3,128
3/14/2006,1:31 PM,4.0,1206,6.3,128
3/14/2006,1:31 PM,4.0,1211,6.3,129
3/14/2006,1:31 PM,4.0,1215,6.3,129
3/14/2006,1:31 PM,4.0,1220,6.3,129
3/14/2006,1:31 PM,4.0,1225,6.3,129
3/14/2006,1:31 PM,4.0,1230,6.3,129
3/14/2006,1:31 PM,4.0,1234,6.3,129
3/14/2006,1:31 PM,4.0,1239,6.3,129
3/14/2006,1:31 PM,4.0,1244,6.3,129
3/14/2006,1:31 PM,4.0,1249,6.3,129
3/14/2006,1:31 PM,4.0,1253,6.3,129
3/14/2006,1:31 PM,4.0,1258,6.3,129
3/14/2006,1:31 PM,4.0,1263,6.3,129
3/14/2006,1:31 PM,3.4,1268,6.3,129
3/14/2006,1:31 PM,4.0,1272,6.3,129
3/14/2006,1:31 PM,4.0,1277,6.3,129
3/14/2006,1:31 PM,4.0,1281,6.3,129
3/14/2006,1:31 PM,4.0,1286,6.3,129
3/14/2006,1:31 PM,4.0,1292,6.3,129
3/14/2006,1:31 PM,4.0,1296,6.3,129
3/14/2006,1:31 PM,4.0,1300,6.3,129
3/14/2006,1:31 PM,4.0,1305,6.3,129
3/14/2006,1:31 PM,4.0,1310,6.3,129
3/14/2006,1:31 PM,4.0,1315,6.3,129
3/14/2006,1:31 PM,4.0,1320,6.3,129
3/14/2006,1:31 PM,3.4,1324,6.3,129
3/14/2006,1:31 PM,4.0,1329,6.3,129
3/14/2006,1:31 PM,4.0,1334,6.3,129
3/14/2006,1:31 PM,4.0,1339,6.3,129
3/14/2006,1:31 PM,4.0,1343,6.3,129
3/14/2006,1:31 PM,4.0,1348,6.3,129
3/14/2006,1:31 PM,3.4,1352,6.3,129
3/14/2006,1:31 PM,4.0,1358,6.3,129
3/14/2006,1:31 PM,4.0,1362,6.3,129
3/14/2006,1:31 PM,4.0,1367,6.3,129
3/14/2006,1:31 PM,3.4,1371,6.3,129
3/14/2006,1:31 PM,3.4,1376,6.3,129
3/14/2006,1:31 PM,4.0,1381,6.3,129
3/14/2006,1:31 PM,3.4,1386,6.3,129
3/14/2006,1:31 PM,3.4,1390,6.3,129
3/14/2006,1:31 PM,4.0,1395,6.3,129
3/14/2006,1:31 PM,4.0,1400,6.3,129
3/14/2006,1:31 PM,4.0,1405,6.3,129
3/14/2006,1:31 PM,4.0,1409,6.3,129
3/14/2006,1:31 PM,4.0,1414,6.3,129
3/14/2006,1:31 PM,4.0,1419,6.3,129
3/14/2006,1:31 PM,4.0,1423,6.3,129
3/14/2006,1:
Shefali 0 Light Poster
thanks comatose for taking so much interest and helping me out. i really appreciate this. i have run the program and here is what i got:
hwnd: 13239932
class: LVDChild
Caption: Acquire Data and Plot 2.vi Front Panel
Window Thread: 2912
Comatose 290 Taboo Programmer Team Colleague
Just to make sure, that's JUST the graph that we want to steal right? Not it's parent, or anything like that, the mouse directly over the plotting area, right?
Shefali 0 Light Poster
actually i wud like only the graph to steal.. but ur program doesnt differentiates between the graph or the labview window(front panel). whenever i take the mouse over the labview window(front panel) it shows the same caption and class.
in that case wud be the stealing of only the graph possible?
Shefali 0 Light Poster
sorry forgot to add this in the previous post:
if capturing the graph isnt possible.. then i wud be glad even to capture the complete front panel of the labview.. only thing is that it needs to show the continuous realtime plot of the data.
Comatose 290 Taboo Programmer Team Colleague
K, Try this and let me know what happens.
This attachment is potentially unsafe to open. It may be an executable that is capable of making changes to your file system, or it may require specific software to open. Use caution and only open this attachment if you are comfortable working with zip files.
Shefali 0 Light Poster
i run ur code. i first started labview manually and run the labview program. then i run ur vb code. when i run the vb code it displays the labview window infront of the form (not on the form) as a seperate window.
what i though after running the code is it puts the labview front panel at the foreground. am i missing something?
Comatose 290 Taboo Programmer Team Colleague
if you minimize the VB form, does it minimize the labview window too?
Shefali 0 Light Poster
no.. it doesnt
Comatose 290 Taboo Programmer Team Colleague
Hmn.... for some reason it's not setting the labview parent...... I don't have labview, so I can't test it, but the same code works for notepad (if I change the class to "Notepad", and then run notepad).... maybe we'll have to go to the text file way.... I can give you code to open the file, and read in the values, and I can give you info on PSET, but I don't know much about graphing or plotting, so after that you will be on your own..... I wish I knew why it won't kidnap labview :(
Shefali 0 Light Poster
hmm.. ok i was really upbeat abt getting this kidnapping thing done. bad for me it didnt work.
yea maybe u r rite.. maybe i have to go via the textfile/excel file way. i can plot a graph from given values.. but i m not sure how to get this realtime thing going.
hope ur examples wud help me.
thanks a lot comatose.
Shefali 0 Light Poster
comatose.. can u plz give me some code example of graphing from text/excel data file. thanks in advance.
jeylux 0 Newbie Poster
why not pass the data over local host? TCP/IP....
it would solve this text file issue as that isn't a good way to do it.
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.