LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing text colour (if value over 0.5 text will be red, below 0.5 text will be black)

I have an array of accumulated mean value, i want to change the mean value that over 0.5 to red and below 0.5 to black, but I still the array will be in same order as before the comparison happen. Need anyone help me on this and thank you in advance.

text colour.png

e.g :

Segment 1, Mean 0.3(black)

Segment 2, Mean 0.6(red)

Segment 3, Mean 0.7(red)

Segment 4, Mean 0.2(black)

.

.

0 Kudos
Message 1 of 5
(213 Views)

We don't debug pictures, so please attach your VI (do a "save for previous", 2020 or below if you use a newer version).

 

In general all elements of an array share the same properties, including color. You could show your values in a table, for example.

0 Kudos
Message 2 of 5
(198 Views)

Font characteristics (including color) are settable on separate groups of characters.

paul_a_cardinale_1-1724245499581.png

Note that you must set colors after the string value is sent to the indicator.  So you've got some extra coding to do in order to figure out the Start & End positions of all the differently colored substrings.

0 Kudos
Message 3 of 5
(162 Views)

You would make you life significantly easier by using special indicator. For example a listbox would work perfectly.

 

Maintaining start and end position of each virtual field in one very long string is just herding cats. It can be done, but it will be much more complicated and there will be many more places for bugs to hide.

 

Here's one possibility:

 

altenbach_0-1724253676958.png

 

And if you just want the number to be red, you could use a multicolumn listbox or a table instead.

Message 4 of 5
(152 Views)

@akimkhal wrote:

text colour.png


On a side note, there are some significant flaws, at least from the visible part of the truncated picture.

 

  • It is unusual to have a FOR loop with an autoindexing input tunnel ***AND*** N wired. That only makes sense if you don't want to process all array elements.
  • There is a "+1" primitive
  • Not sure why you initialize the SRs with a blue array if everything else is orange (The compiler will fix it for you behind the scenes, but it's just ugly)
  • Format strings should not be sized to show nothing informative. You can place it before the loop and make it bigger.
  • We cannot tell what's is the other case, but my wild guess is that it contains basically the same code, just with a different color and maybe format string. If this is true, everything else should be outside. No need for all that duplicate code!.
  • Most likely you can eliminate the orange shift registers and use autoindexing output tunnels. Make them conditional if needed.

We can probably give more specific advice of you would attach the actual VI.

0 Kudos
Message 5 of 5
(141 Views)