LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying Correct Time in XY Chart

Solved!
Go to solution

I have an XY Chart displaying current over time.  A measurement is made every x seconds.  I would like the x axis to represent how many seconds total the measurement was made (ie, the first point at 0 seconds, the second at 5 seconds, third at 10 seconds assuming 5 second intervals).

 

I want my plot to display the data after it has recorded.

 

My problem:

 

If I format the x-axis to absolute time, it always displays the start time as 07:00 PM 12/31 and increments it by one second regardless of how long the interval was.

 

If I format with to relative time, it increments the seconds by 1 second regardless of the interval.

 

Maybe I need to use a more sophisticated graph, but it was recommended that I use a chart because I had problems with Labview closing/crashing in the middle of an experiment.

 

I included my code.  Please let me know what you recommend.

0 Kudos
Message 1 of 14
(5,044 Views)
Solution
Accepted by topic author _natalie_

First of all, there is no such thing as an XY Chart.  You are using just a plain Chart.  Now with that confusion behind us...

 

You need to give the chart a Waveform, not just a single sample.  The waveform includes the time the sample was taken (T0).  So if you build up a waveform and wire that to the chart, the time will actually show up correctly.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 14
(5,037 Views)

With the build waveform, I have to input an array, right?

 

Should I append an array so that I can input it to build waveform?

0 Kudos
Message 3 of 14
(5,018 Views)

Oh sorry, I didn't see the diagram you attached!  Let me try that first.  Sorry!

0 Kudos
Message 4 of 14
(5,016 Views)

Okay, it is almost there now.

 

It is only plotting two points at a time on my waveform chart.  The last value displays the correct time, but the first value is in corrent?  Is it home I am building the array to input to the build waveform.

 

 

0 Kudos
Message 5 of 14
(5,003 Views)

Expand the X scale on your chart.  It is currently set to only spand 3 seconds.  You might want to just expand it to be something like 5 minutes.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 14
(4,983 Views)

If all you want to do is to plot successive points as they come in (at a fairly slow rate), then you can simplify things a lot by simply plotting the data and adjusting the plot X multiplier to reflect the period of sampling.  This snippet illustrates what I mean (the Period control ranges from 0.1 to 10 (sec).

Scaled Plot.png

Bob Schor

Message 7 of 14
(4,978 Views)

Where do you see that it is set to spand only 3 seconds?  Sorry if it is really obvious.

0 Kudos
Message 8 of 14
(4,973 Views)

@_natalie_ wrote:

Where do you see that it is set to spand only 3 seconds?  Sorry if it is really obvious.


I just opened up the VI and saw the chart was from -1 to 1 seconds.  -1, 0, 1 is 3 seconds.  But after posting that, I looked at the properties and saw that you have autoscaling on, so that should not have mattered.  I'll have to mess around with it when I find time.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 14
(4,947 Views)

Thanks so much for all your help!  I find Charts really confusing, but now I understand how to use them with waveforms much better.

 

I am not sure why I was getting that error, but I opened up an older version of my code, added those few changes and now I have two plots.  1 plots records the current against the date and time, and one records the current against the total number of seconds.  I didn't realize that the total number of seconds counts from 1904, but I was able to work around that by substracting the current time and from the amount of seconds since then and it is working.  I was able to clear my plots by going to File-VI Properties-Execution and clear indicators when called.

 

Thanks again!  Always very helpful 🙂

0 Kudos
Message 10 of 14
(4,922 Views)