09-16-2008 12:02 PM
I have an array of up to 64 name-value pairs -- one for each sensor channel (thermocouple, pressure transducer, etc.). I would simply use an array of clusters with the name and value, but I also want to be able to flag when a particular value goes out of limit. I want to change the background color of the value to yellow or red depending on the value. As I understand it, I cannot change the properties of individual items in an array. 😞 So I'm forced to explicitly lay out 64 string and numeric indicators (even if I'm not using them all)! Yuck.
Surely I'm not the first LabView user who wants to color-code a telemetry array display! Is there a better way to do this? I've looked at the multicolumn list box but that seems to be aimed at allowing the user to select something from a list -- not strictly display things. Besides, I don't see a way to change the colors of an individual cell for the listbox either.
Please help!
Keith.
09-16-2008 12:06 PM
09-16-2008 12:35 PM
OMG! That's one of the ugliest hacks I've seen! But it does work. Of course, I can't change the font color to ensure high contrast when the background changes.
Why doesn't LabView have a cleaner way to do this? Or at least a numeric widget that has built-in red/yellow limit processing? I feel like I'm going to hell for sure if I use this color box hack ... 😉
Thanks,
Keith.
09-16-2008 01:12 PM
I agree it is ugly.
Since you want to exclusively use this as an indicator, you might want to display your data in a table indicator. Here you can set the color of individual cells at will.
09-16-2008 03:55 PM
Table sounds great, but I didn't mention that speed is also a concern. When I use a table, my VI is way too slow compared to the collection of basic indicators. Perhaps I'm not using the table efficiently? Attached is a diagram of the update VI that sets the values and colors in the table.
Thanks,
Keith.
09-16-2008 06:52 PM
You should probably "defer panel updates" during the execution of the loop. It should make a big difference in performance.
(Do a search for "defer panel updates" here in the forum for details).
09-16-2008 07:16 PM
FYI, I wanted to be sure I'm using the fastest display approach, so I made a test VI to measure the 4 different approaches (attached). Here are the results on my machine (10000 iterations):
Basic Indicators: 3.1 ms
Cluster Array: 0.002 ms
Table: 7.5 ms
Listbox: 9.4 ms
Something about the cluster array makes it 3 orders of magnitude faster! What am I missing here?
Keith.
09-17-2008 12:29 AM
It is the only one that does not use property nodes.
Use the defer panel updates if you really have to use property nodes (as Christian said)
09-17-2008 02:52 AM
09-17-2008 01:17 PM
OK, I added defer panel updates and it did speed up the table and listbox significantly (down to around 3 ms) but still not as fast as the cluster array. (BTW, replacing the active cell read with a constant had no effect.) But here's what's weird: with the defer, the cluster array is incredibly slow -- around 7 ms! Not sure what to make of this other than avoid property nodes at all costs -- even if it means using an ugly transparent indicator hack so I can change the BG color ...