raining010 Posted October 21, 2013 Share Posted October 21, 2013 Hi, Admin The customer needs to display log file in the DAQFactory using trend type. I already display it in the table, define 10 variables to display different column of log file. The code is like below Private i=0 While(1) F_line = file.Read(F_handle,1) //break out if empty string, meaning end of file If(F_line == "") break Endif L1=FormatDate((strtodouble(Parse(F_line,0,","))-365*70-19)*86400) //get date L2=FormatTime((strtodouble(Parse(F_line,0,","))-365*70-19)*86400) //get time L3=Parse(F_line,1,",") //get current i++ Endwhile To display above in table component is easy, and the value of L1 in table is like 10/12/13, the value of L2 in table is like 11:03:12. But to display this in trend, I haven't found the way. Y axis is L3, X axis is L2. After test, the L2 in trend always display value of hour. How can I pick up the time including minutes seconds, and display it in X axis of table? Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted October 21, 2013 Share Posted October 21, 2013 A few things. One, you can't plot strings, and I'm guessing L3 is a string. So, you need to convert L3 to a number. Likewise, you can't plot a string representation of a date. "11:03:12" means nothing to the graph. Next, you really should consider using readDelim() instead of reading the file line by line. It will be MUCH faster. I personally would add another global variable to store the values as numbers and stick the time right there. So add something like: global graphY while(1) ... // your code L3 = parse(...) graphY = StrToDouble(parse(F_line,1,",") graphY.time = (strToDouble(parse(F_line,0,","))-365*70-19) * 86400 i++ endwhile Actually, I'd do the graphY first, then calculate your L1-3 based on those values instead of calling Parse() multiple times (which is kind of slow). But that all said, I'd still do it with readDelim(). Also, note that you'll probably need to sort graphY at the end: graphY = sortTime(graphY) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.