LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to mark time on x axis with irregular time values

Hi All,

This may be very simple but i somehow cant find out an obvious way to do it.

I need to plot an XY graph (2d array) with the x axis to be time info such as Date. But not every day I have data points to plot, so there will be gaps regarding time. I dont want to use timestamp as that will be continueous. I can plot out the Y axis (numeric values) against the data point index (as 0, 1, 2, 3...and so on). Then i need to mark the x axis with the date string such as (11/02/04, 11/03/04, 11/07/04, 11/08/04...and so on). Can anyone point to the best way to do this? Thanks a lot!

Bryan
0 Kudos
Message 1 of 32
(4,846 Views)
I'm not quite sure I uderstand the issue. What does your x data look like and how do you know when it was sampled? How do you know, for example, to convert 3 to 11/7 or 11/8, or any other date? If you know this, then you can convert to a timestamp. Each timestamp does not have to be continuous. In any case, only numerics are allowed for x and y values.
0 Kudos
Message 2 of 32
(4,833 Views)
Hi Dennis,

My data file is a spreadsheet file with a 2D array, i.e., two columns with the firt column being the date in the format of MM/DD/YEAR. The second column is numerics. If I read this file into a numeric 2D array, i will lose the real meaning of the first column. That is fine as I can plot the 2nd column versus the point index. Then I need to mark the x axis with the string data of my original 1st column in the date format. Is this possible at all? I doubt that LabVIEW cant handle something this simple, it must just be my skills in LabVIEW that is limiting...

Bryan.
0 Kudos
Message 3 of 32
(4,823 Views)


@Dennis Knutson wrote:
I'm not quite sure I uderstand the issue. What does your x data look like and how do you know when it was sampled? How do you know, for example, to convert 3 to 11/7 or 11/8, or any other date? If you know this, then you can convert to a timestamp. Each timestamp does not have to be continuous. In any case, only numerics are allowed for x and y values.




Hi Dennis,

Maybe I didn't answer your question clearly enough in my last reply. I know the date of 11/7, 11/8 and so on from reading the string array out from the first column of my spreadsheet data. By indexing the array, I know which index correspond to which date. Hope this help to clearify it. Thanks again.

Bryan
0 Kudos
Message 4 of 32
(4,823 Views)
I don't think you can do this in the graph itself. I tried arbitrary spacing but that didn't help. You can place a string or a string array where the plot is and wire the data into that, but you'll have to align it somehow.

___________________
Try to take over the world!
Message 5 of 32
(4,811 Views)
When you read the spreadsheet data, read it as strings. You can then convert the date to a timestamp like shown in the attached picture with a Scan From String and a Date/Time to Seconds function. The time stamps become your x array for the graph. In the X Scale formatting for the XY Graph, select absolute time and turn off the time display.
0 Kudos
Message 6 of 32
(4,804 Views)
Alignment is not what i want, but thanks for the reply. Bryan
0 Kudos
Message 7 of 32
(4,782 Views)
Dennis,

Thanks, this must work. Earlier I thought using timestamp must also require a linear or continueous time axis. I guess the XY graph ensures that irregular timestamp values can be displayed without a gap.

Bryan
0 Kudos
Message 8 of 32
(4,782 Views)
Hello Dennis,

It turned out my worry is valid that the LabVIEW DOES leave gaps in my XY graph when plotting against irregular time intervals after converting the time string to timestamp and then plot.

Please see attachment for result.

I wonder how do i remove those gaps?

Bryan.
0 Kudos
Message 9 of 32
(4,773 Views)
sorry forget to attach...
0 Kudos
Message 10 of 32
(4,684 Views)