08-01-2011 11:35 AM
I have an application which runs non stop and sends collected data to a txt file. I have labview then reading that file and displaying the contents on a chart. I want the X-axis of the chart to be in the correct local time, so that users can see how the data changes throughout the day. Ideally, it would show the data over a 24-hour period with the max being the current time and the min being the time 24hrs ago. I'm guessing this has something to do with time stamps and is probably simple, but I can't figure it out. Any ideas? Thanks
Solved! Go to Solution.
08-01-2011 11:54 AM
Do you actually have time data in the file you are reading? If you don't, you cannot programatically set the x-axis. Attach a sample file.
p.s. It's also silly to read the same file over and over again in a while loop.
08-01-2011 12:04 PM
You probably want to use a graph instead of a chart file. Charts are generally used to display data continuously while the chart displays a view at a time (you will need time stamps for this operation)..
08-02-2011 06:05 AM
Hi James,
If you know the start time and the sample interval then you can have the chart set the time axis for you.
Set the chart X Axis to Relative Time. Be sure to set the Chart History Length to be long enough to display all of the samples you want to display.
See the attached example. Here is the block diagram:
steve
08-02-2011 12:22 PM
Thanks, I will try out these ideas. The reason why I have it set to read the file in a while loop is because the data never stops coming in. I'm not sure what the time interval is, but I'm guessing about every second. The data comes in 3 numbers separated by a comma, for example (26.987, 3.005, 32.564). The second number isn't important, but the first number is temperature in Celsius and the third number is salinity. As this data is put into a txt file, I have labview pull the data from the text and display it. Could I use a graph and just update it every X seconds and append the new data to the existing graphed data? or would it overwrite the existing data? Thanks-James
08-02-2011 12:40 PM
Since your are reading the entire file, you would have to use a graph and display all of the data you read. That would overwrite everything in the graph. If you change your code to only read new data, then you could use a chart. Currently, since the rate you read is going to be different than the rate that is being written, the x axis is going to be meaningless unless there is actually time data being written to the file. If not, that would almost force you to detect when the file has changed and use that information. An XY Graph might be your best option in that case.
08-09-2011 10:20 AM
So, the chart starts at the correct time, but the clock still runs to fast. No, there is no time data in the input file, but is there not some way I can sync the X-axis with the computer clock? The data is being recorded in real time, so I just need the X-axis to display the current time and change as appropriate. I just want the x-axis to show how the data is changing over real time. Thanks -James
08-09-2011 10:45 AM
So, I put the time info in the while loop and the time displayed is correct, but now my chart is acting weird. It's blinking on and off. I'll mess around with it some more, let me know if you got any ideas, Thanks -James