YamidP Posted March 25, 2020 Share Posted March 25, 2020 Good night, everyone I'm currently working on a project where I want to graph data vs time (2D graph). The data (Y axis) and time (X axis) is collected through SQL queries. The time data in the database is of datetime type, however, DAQFactory shows it in other values (see image ) What should I do to have the same type of data in DAQFactory? what kind of time data does daqfactory support? thank you Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted March 25, 2020 Share Posted March 25, 2020 DAQFactory wants time in UNIX time, which is seconds since 1970. Today's date is a little more than 1.5 billion, and from the look of it, Time.DateAndTime are already in this format. So, you just need to combine Millitm and DateAndTIme (by dividing Millitm by 1000 and adding to DateAndTime). Then you can use the result as the X axis expression for the trend graph, or alternatively, stick the time stamp into the time portion of the main variable. So, if you have: myVariable = // some data from the database DateAndTime = // time stamps in proper form from somewhere myVariable.time = DateAndTIme // assigns time stamps to time portion of myVariable Once you've done that, then the X expression can just be "Time" as default. Be careful with your queries though. You make two queries to the same database, with one being sorted and the other not. That means the results won't line up. You should instead consider just doing one query and getting all the data as one. Quote Link to comment Share on other sites More sharing options...
YamidP Posted March 25, 2020 Author Share Posted March 25, 2020 Hello, Guru, I got it right. The data sets are: Y-axis = test.Milltm determined by the following consultation global test = db.QueryToClass(dbase, "SELECT Millitm FROM [Tecnofar_CIP]. [dbo]. [FloatTable_CIP_Globales] ORDER BY DateAndTime asc") X-axis = test.Time or "Time the image shows the configuration. is this configuration correct? Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted March 26, 2020 Share Posted March 26, 2020 It is correct if you assigned the time stamp to the time portion of test.millitm. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.