Graphing Data vs Time


Recommended Posts


I need help please...

I need to graph a table. Like this:

Value Date/Hour

5.5 2008-05-29 11:04:05

5.9 2008-05-29 11:05:05

6.2 2008-05-29 11:06:05

6.5 2008-05-29 11:07:05

6.9 2008-05-29 11:08:05

I put the date/time in the axis X of the graph, as follows, "time_varible.Time", the scaling is since first date until last date, without "time width", its style is "Date+Time".

But I can't put the data in the axis Y of the graph. Its style is "Lin", and scaling is -5 to 40.

In the expression of axis Y and X I have an arrays (we check with F6).

Thank for advantage

and... sorry, but my English is not very good

Link to comment
Share on other sites

I'm not quite sure what you did. Perhaps you can post your .ctl document. You should be able to create a new graph, open its properties, enter your channel name in the Y Expression, leave the X Expression as "Time", which automatically pulls the time from the Y Expression. Then go to the Axes tab, click on Left Axis 1, and set the Scale from and Scale To to -5 and 40 and click ok.

Actually your english is quite good!

Link to comment
Share on other sites

First, the reason you didn't see your replies is that this forum is moderated. That means that we have to approve all posts before they are visible. This is because spammers would otherwise post to put links to sex and other inappropriate sites on the forum. Even though we would remove it, they would do it anyway, just to have it visible for a few hours until we catch it. Now, on to your question:

I did not realize you were using static data. If you were using a channel this would all be automatic. The best method is to assign time to the data variable. So, instead of creating two variables, one for data, one for time, you should create a single variable and assign time to it as well:

global data = {6.5, 6.6, 6.7, 6.8, 6.9, 7, 7.1, 7.2, 7.3, 7.4, 7.5, 7.6, 7.7, 7.8, 7.9, 8, 8.1, 8.2, 8.3, 8.4, 8.5, 8.6, 8.7, 8.8, 8.9, 9, 9.3, 9.5, 9.7, 9.9, 10}
data.time = {1212059062, 1212059082, 1212059102, 1212059122, 1212059142, 1212059162, 1212059182, 1212059202, 1212059222, 1212059242, 1212059262, 1212059282, 1212059302, 1212059322, 1212059342, 1212059362, 1212059382, 1212059402, 1212059422, 1212059442, 1212059462, 1212059482, 1212059502, 1212059522, 1212059542, 1212059562, 1212059582, 1212059602, 1212059622, 1212059642, 1212059662}

Now the second problem is that your time values are backwards. DAQFactory expects all time associated with data to be from the most recent time to the oldest time. Fortunately, there is a function that will do this for you:

data = sorttime(data)

Then you can just plot data vs Time as shown in the attached sample. If you want the table to list from oldest to newest, create two variables, one for the graph sorted using sorttime() and one for the table as original.


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.