LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

activeX cw graph3D time format question

Solved!
Go to solution

Regarding the Component Works / ComponentWorks 3D graph ActiveX OCX control:

 

I have an array of LabVIEW timestamp's ("The default value is zero seconds since 12:00 a.m., Friday, January 1, 1904, Universal Time [01-01-1904 00:00:00]") that I convert to an array of Doubles.

I would like to pass this array to the OCX (after some conversion) as my y-axis. I have configured the OCX to display DD/MM/YYYY HH:MM:SS using the property editor. Further, if you dig into the OCX documentation, in the section that details the formatting strings, it says:

 

"With ActiveX controls, the date is implemented as a floating-point value, measuring days from midnight, 30 December 1899. So, midnight, 31 December 1899, is represented by 1.0. Similarly, 6 AM, 1 January 1900, is represented by 2.25, and midnight, 29 December 1899, is -1.0. However, 6 AM, 29 December 1899, is -1.25. To interpret the time portion, take the absolute value of the fractional part of the number. Thus, 1 second equals 1 / 24 hours / 60 minutes / 60 seconds, which is 1/86400 or approximately 1.157407e-5."

 

Maybe my coffee isn't strong enough today, but I don't see any easy way to convert from LabVIEW's format into the "ActiveX format" while properly accounting for leap years etc. .

 

My first hope is that someone has already done this, my backup plan is to have some good brainstorming on the forum on how to do this?

 

thanks for any input on this! 

 

 

QFang
-------------
CLD LabVIEW 7.1 to 2016
0 Kudos
Message 1 of 8
(2,978 Views)

Search the forums for some posts about converting Excel date and time to LabVIEW data and time.  Excel is based on days since Jan. 1, 1900 where that date is 1.  (Zero is Jan. 0, 1900 whatever that means.)  Note also Excel has an error in that it thinks 1900 is a leap year and thus Feb. 29, 1900 exists.

 

Since it seems like your activeX date is similar to Excel but perhaps with a different start date, those Excel date/time threads should be able to help you with the conversion.

Message 2 of 8
(2,973 Views)

Ravens, that was a harder search to do than you might expect, so I added some tags once I did find it.... but THIS is pretty much exactly what I need.. I think. 🙂 

QFang
-------------
CLD LabVIEW 7.1 to 2016
0 Kudos
Message 3 of 8
(2,969 Views)
Solution
Accepted by topic author QFang

I made some modifications that might be useful for others digging for gold in the forum.

 

In my case, I have an array of strings that gives the date and time for when the data was captured.

The date and time strings could have been captured in a different time-zone from the computer where I'm running the post analysis and visualization. As such, you need to take care so that you don't end up adjusting your times incorrectly based on your analysis computer time-zone vs. where the data was captured.

 

I don't know if perhaps there is a slicker and more optimized way of doing this, but I benchmarked it and for the data sets that I'm loading, the time needed to do this conversion is fairly trivial.

 

I guess the key point people looking should take away is that the "format into string" and "format from string" VI's are extremely powerful and its worth the effort to walk the learning bump of how to create the format specifier strings... 

 

NI time-date to OLE time date.png

 

The code in the image shows how I convert from a string format, to the OLE/ActiveX time format without changing the time that I have in the original string array. I can then feed this as (in my case) y-axis array to the CW 3D graph where  my axis has been configured to display "time" (right-click ActiveX container, "CWGRAPH 3D-->properties", go to "format" tab, select your axis and pick the display format of your choice.

 

coincidentally, trying to do the same using the xControl turns into a nightmare where the only solution I found was to use value-pairs and a lot of code to handle the positioning and decimation of the value pairs to make it display correctly.. Overall, my processing has now gone from a lot to almost nothing... and as a bonus, the CW Graph cursors use the same formating settings, so my date/times show up on the cursor too, on the xControl, the cursors use the number part of a value pair, so your cursor doesn't match your axis.. 

QFang
-------------
CLD LabVIEW 7.1 to 2016
Message 4 of 8
(2,966 Views)

@QFang wrote:

Ravens, that was a harder search to do than you might expect, so I added some tags once I did find it.... but THIS is pretty much exactly what I need.. I think. 🙂 



You're right.  I tried to search for it as well.  I think there are one or two threads that are really good, and even one thread where a regular forum user posted some conversion subVI's.  But I couldn't find them.

 

There are a lot of threads that show up on searching that either say "it exists, search for it"  (like mineSmiley Embarassed), or are just some very bad examples of the conversion.  The one problem with this topic is that the more often it gets asked, the harder it becomes to find the better threads that do a good job answering it.

0 Kudos
Message 5 of 8
(2,962 Views)

Is adding tags to posts a good way to increase the chance that people find "the good ones" a valid approach? I taged the thread I linked to, and also tagged my own "answer" post.. hoping that makes a difference for people searching for similar things.

QFang
-------------
CLD LabVIEW 7.1 to 2016
Message 6 of 8
(2,958 Views)

Theoretically, tags are a good way.

 

But I don't use them, and I don't know how many people actually do.

 

I don't know how well tagging posts helps the priority of results when doing a normal search.

0 Kudos
Message 7 of 8
(2,955 Views)

@QFang wrote:

Is adding tags to posts a good way to increase the chance that people find "the good ones" a valid approach? I taged the thread I linked to, and also tagged my own "answer" post.. hoping that makes a difference for people searching for similar things.


 

At one time it was. When tags were first added I experimented with them and they did help the search engine find the tagged threads.

 

I don't knnow what the stae fo the search engine is at the moment.

 

It does help those that use tags.

 

My LAbVIEW_3D tag cloud is cross linked with the 3D tag cloud that includes this thread.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 8
(2,953 Views)