LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Chart X axis--Current time

Solved!
Go to solution

Almost forgot to ask... Why on earth would you want to represent real time in BINARY???

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 31 of 55
(1,080 Views)

NIQuist,

First, I want to thank you for putting all of the pieces and parts into the first example I have seen on this board that makes sense to me.  I state it that way not to reflect any dispersions on any of the other posters.  I put all of the novice-ness (a word?) on myself.  I will continue to attempt to make this work.  Right now, the stumbling block is taking your code and putting it into my working vi.  I used all Express code and now I am breaking it down into the basic code to make it work.  FINALLY, I am able to use the 'offset' as you explained it!!! Thanks.

0 Kudos
Message 32 of 55
(1,079 Views)

NIQuest,

Can't seem to figure out how to put mulitple plots on your example. 

0 Kudos
Message 33 of 55
(1,075 Views)

You just bundle scalar data to create a multi-plot.  Note that I needed to change my constant for the History Data in the Reset case structure as well.

 

EDIT:  Oop, I meant to make the History Data in the Reset case structure a constant, not a control.  Still works as is but just right-click the block diagram terminal and "Change to Constant" if you use this technique.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 34 of 55
(1,065 Views)

NIquist,

I have adopted your layout to get this accomplished and now I feel like a real idiot.  I have used the Express vi's for so long for my graphing needs that I can't seem to add a fourth trace to the graph!  I add a fourth to the array to cluster block and, of course, the software tells me the graph is only three plots deep.  I give.

Ron

0 Kudos
Message 35 of 55
(1,046 Views)

Don't feel too bad.  I've been programming with LabVIEW since version 5 and I still have to look at the help and examples when I haven't worked with graphs for a while.  If you got broken wires when changing the number of plots it's probably because that History Data property node needs to be updated.  This issue won't occur if you have no property nodes but it's good to be aware of it just the same.

 

If you added another input to the Bundle node in my example you'll need to replace the array constant connected to History Data to one with the appropriate number of arrays (now 4).  Easy way is to erase it and right-click "History" and select Create > Constant.  That way LabVIEW figures out the proper sized array automatically.

 

Don't get discouraged.  The various graphs and charts built into LabVIEW may have their learning curve but their power makes them worth the time it takes to understand them.  

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 36 of 55
(1,039 Views)

One more thing I should mention that trips up chart users is the Chart History Length.  Right-click a graph, select it  and you can see it defaults to 1024 point.  That means the chart will roll over at that many points discarding the old data in a circular buffer fashion.  Now you can set this to something ridiculous like 999999999 and use a chart to save months worth of data but of course you risk losing it all if the computer goes down.  With the price of memory these days though 1024 point is a "bit" stingy. Smiley Happy  I usually set it to 9999 or 99999 so I have a reasonable buffer.

 

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 37 of 55
(1,032 Views)

NIquist,

Your 'charts' example, as I already stated is an excellent example, well documented, but I am still  missing one thing.  I am currently getting what I want with 'string indicators', yet your example has the correct time called right from the plot.  Your x axis is 2 minutes long, I would like it to be 24 hours, yet I can't see where you set it.  The x axis offset uses that NI ridiculous seconds since the begining of all mankind calculation (No one as yet has explained that one).  I guess I just need to know how you set the x axis to 2 minutes so I can set it to 24 hours and your example is worth more 'KUDOS!'.

Regards,

 

Ron

0 Kudos
Message 38 of 55
(1,016 Views)

You can use the X scale Maximum property to set the end time of a chart.  Look at the "End Time" event in this new VI.  I used an event because if you just use a control which is read every cycle the chart flickers.  

 

Remember that you will be limited by the chart history length so set it for enough points to cover a 24 hour period at the time resolution you're using:  e.g:  For one second chart updates you'll need at least 86400 points to cover a 24 hour period.  (That's more points than you can actually see on any monitor but it allows you to zoom in if you want.) 

 

Also, of course, you'll need to turn off autoscaling for the X axis.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 39 of 55
(996 Views)

BTW, Labview's choice for the start of Epoch time (1904) is because it's the first leap year in the century.  There are stranger choices:  http://en.wikipedia.org/wiki/Epoch_(reference_date)

 

I guess as long as it's far back enough the choice is pretty arbitrary.  Smiley Indifferent

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
Message 40 of 55
(994 Views)