Plotting future events in static data vs time graph


bpereira

Recommended Posts

Hi, I would like to have a graph that shows all of today including future events. So it would start at midnight and go to midnight. I want this to be a static, not scrolling graph. So as data came in it would plot from left to right as time progresses. I'll use some scripting to populate some arrays or v channels that will display to the user when things will happen thru out the day based on their process parameters. And then of course plot the actual data as the day progresses.

The main problem I am having is getting the graph to display the proper time window. I've tried un-checking the use time width option for the x axis and entering min and max values in time format but it doesn't scale the x axis properly. For example, I tied entering 11y05m10d 0h0m0s for min and 11y05m11d 0h0m0s for max to try and get a 24 hour window for today(5/10/11) and the edit boxes went green but I get an x axis scale of like six years, although it does go into the future and I do see a little blip of data around today's date. Obviously hard coding a date like this is not going to work everyday but it was the simplest way to test using time for min/max.

So what am I doing wrong? Can it even be done?

Link to comment
Share on other sites

I don't know about the manual time entry and why it picked up the wrong range. Its probably something simple, but as you said, its not what you want anyway.

As for doing what you want, its actually pretty straight forward once you remember that date/time in DAQFactory is just a number corresponding to the number of seconds since 1970, with Midnight 1/1/70 being 0. That means that if you round the current system time down to the nearest 86400 (number of seconds in a day), you get midnight last night. So, the scale from formula is just:

Floor(SysTime()/86400)*86400

while the scale to is just:

Floor(SysTime()/86400)*86400 + 86400

You could replace SysTime() with the time of the most recent data point in your array as well.

Link to comment
Share on other sites

Archived

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