From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-27-2015 01:17 PM
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.
Solved! Go to Solution.
07-27-2015 01:29 PM - edited 07-27-2015 01:30 PM
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.
07-27-2015 01:44 PM
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?
07-27-2015 01:44 PM
Oh sorry, I didn't see the diagram you attached! Let me try that first. Sorry!
07-27-2015 02:00 PM
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.
07-27-2015 02:09 PM
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.
07-27-2015 02:10 PM
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).
Bob Schor
07-27-2015 02:15 PM
Where do you see that it is set to spand only 3 seconds? Sorry if it is really obvious.
07-27-2015 02:32 PM
@_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.
07-27-2015 03:17 PM
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 🙂