LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Chart X axis--Current time

Solved!
Go to solution

OK, now I am getting into Pit  Bull mode.  I am going to wrestle this thing to ground if it kills me.  My vi currently goes to the NewFileName page first to create the file.  There I clear the array for all three plots.  I then get the computer clock and feed that into a property node for 'X min'.  I add 14400 seconds to that and connect that to a property node for 'X max'.  This will give me a viewing window of 4 hours.  Much better for discerning what is going on in the first 10 to 30 minutes than looking at a 24 hours viewing window.  The vi will still fill the file for 24 hours and then close it and start a new file.  So, having done the above, I am now looking at a graph with 6 PM instead of 6 AM!  I am getting the 4 hour difference across the X axis (YEA!!!!), but it goes backwards to an earlier time.  I suspect I need to change the X min and X max?  Finally, and this is the most perplexing, the date is 17/01/70.  I have an time indicator block that is reading the computer time and date and that is right on the money.

Ron

0 Kudos
Message 51 of 55
(625 Views)

I have finally taken some time to test out the suggestion/solutions. I am looking to create a chart with 24 data points, one for each hour, and then following the 24th point just before posting the 25th value clear the history and start the chart over at hour one, with the current date and time of the first hour. I would like the x-axis to show 24 incriments but it seems to only "book end" the chart.

0 Kudos
Message 52 of 55
(616 Views)

Final version - Upon vi initialization the starting time and date and put it in a string indicator at the top left corner of the waveform chart.  Read the present time and date while the acquisition is running and put it in another string indicator at the top right corner of the waveform chart.  NI, you win, I give up.,

 

0 Kudos
Message 53 of 55
(606 Views)

I going to attempt to put all the suggestions in the thread that pertain to the original question in one post. Please refer back to the posts to provide kudos to those who have assisted in solving the problem. 

 

  • Set the x-axis current date and time, use the Get Date/time function wire it to a DBL conversion, wire the DBL to the X-axis offset property node
  • Set the Chart Multiplier to a constant value (in seconds), IE...a constant of 10 should plot a value every 10 seconds
  • Set the property nodes outside the while loop
  • Set a wait (ms) timing function inside the while loop. Wire a constant value to the input of the wait function (in milliseconds, 1 second =1000 ms). If the value of the multiplier is 10, then the wait function constant will be 10,000.
  • To set the viewing area of the chart use the min/max property nodes. Wire the min. node to the output of the Get Date/time function converted to DBL (same as the X-axis offset property node). 
  • wire the x-axis max property node to a constant, the constant value is in seconds (1 hour of data would require a constant value of 3600 seconds) 
  • Set the chart to "scope". Using scope at the end of the max node value the chart should clear and continue plotting from left to right, as if the display had been reset. 
  • Change the x-axis minor and major ticks to view less values on the x-axis or more (respectively)

The solution to my problem should be to set the Multiplier to 3600, plot a value every one hour. The wait function set to 3600000 ms. Wire the min value to the Get/date/time function conversion DBL, set the max constant value to 86,400 (24 hours) . Show only major tick marks on the x-axis. Set the chart to scope, or wire a shift register to add +1, once the value reaches 24 then trigger a true/false to clear the chart or re-initialize the vi to default values.Smiley Frustrated

 

0 Kudos
Message 54 of 55
(595 Views)

FWIW: I wrote an article about this a few years ago

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 55 of 55
(585 Views)