04-05-2013 06:36 PM
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.
Solved! Go to Solution.
04-06-2013 12:37 PM - edited 04-06-2013 12:44 PM
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:
Here's what I got after about a minute:
You can create an XControl out of this if you use it in many places, but it's probably not worth the effort otherwise.
04-08-2013 03:21 PM
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...
04-08-2013 03:43 PM
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.
04-08-2013 04:23 PM
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.
04-08-2013 05:39 PM
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.
04-08-2013 07:17 PM
LV 2011 sets two different needles:
Customize control, Edit mode, import picture of the needle
04-09-2013 01:12 AM
@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.
04-09-2013 10:54 AM
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!
04-09-2013 01:00 PM
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.