From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

custom needles on gauge indicator

Solved!
Go to solution

Does anyone have a trick for making different types of needles for a gauge indicator? For example, I would like to show an instantaneous value with the standard needle along with an average or threshold value with either a line or an external, inward pointing triangle. I thought of using arbitrary scale markers and extending the tick mark, but can't seem to do that either. I can do both of these things on a slide indicator, but can't seem to do the equivalent on a gauge. I know I could probably do this with an image, but that seems like a lot of work.

0 Kudos
Message 1 of 10
(7,246 Views)

I don't think this is possible with a single gauge indicator (Only very specific LV decorations can be used as rotating needles), but it is possible (and actually quite simple) if you use two.

 

What you do is this:

 

  1. Drop a gauge and select Advanced>>Customize in the right click menu.
  2. Go into customize mode by clicking the wrench in the toolbar and you can now edit the individual parts of the control.
  3. Move the circle in the middle out of the way.
  4. Grab the middle end of the needle and move it so that the needle is now small and pointing inside.
  5. Grab the needle itself and position in on the circurmference.
  6. Go back to edit mode and make everything else transparent, including setting the scale style to empty.
  7. Close the control editor and apply the changes to the original control.
  8. Now drop another control, set them to be the same size and location and move the custom control so that it is on top.
  9. You now have two gauges which appear as one and one has the needle on the outside.

 

Here's what I got after about a minute:

 

Double gauge.png

 

You can create an XControl out of this if you use it in many places, but it's probably not worth the effort otherwise.


___________________
Try to take over the world!
0 Kudos
Message 2 of 10
(7,215 Views)

Thanks for the quick response. I had thought of that but immediately dismissed the idea due to known performance issues with overlapped indicators on the front panel. However, I just did a quick test which showed no difference in performance on my development machine. Has LV fixed this issue? I just did a search and found a post from 2011 (subject: slide bars slow EVERYTHING, I dont understand!!!!!) which leads me to believe this is still a concern. I'm running 2011 SP1. The program will eventually be run on a touch screen computer with a much slower processor and of course, I don't have one to test on...

0 Kudos
Message 3 of 10
(7,174 Views)

A colleague just gave me a great suggestion to use the colour ramp properties to mimic a needle. This could work nicely, but I may want to have an actual colour ramp, as well.

0 Kudos
Message 4 of 10
(7,169 Views)

If a circle marking average position will go, you can import a picture instead of one needle from file. Circle because the picture does not rotate, from file because it supports transparent background.

0 Kudos
Message 5 of 10
(7,160 Views)

If I understand you correctly, you mean to replace the triangular needle with a circular one. The problem is, the gauge won't let you replace just one needle, it will change them all. I am looking for a way (other than just colour) to distinguish between needles and markers. The overlapped gauges seems like the simplist solution, as long as there isn't a significant performance hit.

0 Kudos
Message 6 of 10
(7,148 Views)
Solution
Accepted by topic author Arlon

LV 2011 sets two different needles:

Customize control, Edit mode, import picture of the needle

Download All
Message 7 of 10
(7,143 Views)

@Alexander_Sobolev wrote:

LV 2011 sets two different needles:

Customize control, Edit mode, import picture of the needle


Yes, but as mentioned, they all have to be the same size. In your case, the example works, because you set the first needle to be the full size and the second needle to be a circle, which doesn't change when it's rotated. If you try to resize a needle, the second will resize as well. Also, if you use something that's not a square (or a line), LV will not rotate it as it moves around.

 

 

Arlon, there can be some performance issues when you have overlayed controls (particularly if some of them have gradiented transparency), but it's not usually that bad. As you've seen, in this case there is no problem.


___________________
Try to take over the world!
Message 8 of 10
(7,128 Views)

I think I see where my confusion came from. When I tried replacing one of the needles with an image using Import from Clipboard, both needles seemed to disappear leading me to believe it had replaced both needles (and that the new image woudn't work). However, if I use a line decoration and Import from Clipboard at Same Size, it seems to work just fine. After trying again, it looks like the needles did not actually disappear using the first method, but were moved off the face of the gauge and resized to almost nothing, for some reason.

 

Although I still like the outside inverted triangle idea, I would prefer to have a straightforward solution like this one. At least until I can find some definitive documentation on what "...performance issues...not usually that bad" means.

 

Thank you both very much for your assistance!

0 Kudos
Message 9 of 10
(7,107 Views)

As I hinted in the previous reply, lines are special in that they can be rotated (as you've seen) properly.

 

As for the definitive documentation, I would suggest not holding your breath, as you won't find any. My suggestion - do whichever one you prefer. If you choose the triangle and run into performance issues (although I really wouldn't expect you to), replacing it should be easy enough.


___________________
Try to take over the world!
0 Kudos
Message 10 of 10
(7,086 Views)