From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Community Nugget 02/05/07

This week we are going to have some fun with dials.
 
 
A dial can be a very useful thing. You pop one on your front panel...
and you're ready to display your data in a nice way.
 
However, there can be much more to dials than that.
Let's start by placing the cursor over either end of the scale. You should see the rotate icon -
 
Clicking and dragging will now allow you to play with the scale. Grabbing at the low end value will rotate the dial, as seen on the left side of the image below. Grabbing the high end value allows you to change the shape of the scale, as seen on the right side.
 
So with very little effort we've created a dial which looks different and can make our application more interesting.
 
But wait, there's more. By right clicking the dial and selecting "Text Labels", you can have your scale made up of text labels. You can edit these labels by right clicking the dial after changing to text mode.
This could be useful for any number of things, like compasses or other dials with labels and can be done with other numeric controls, like slides and meters. You could use a slide, for instance, to make a single-selection control, like radio buttons.
 
This is not all. There are other things you can do, like making the ramp visible or making the labels appear on the outer part of the control instead of the inner one or adding needles to the dial, not to mention the things you can do with control customizations. I suggest you go and play.
 
P.S. These are all just simple examples. You can make your application look much better and more interesting by customizing controls and playing with all kinds of options.
 
For a list of past nuggets, see here.

___________________
Try to take over the world!
Message 1 of 13
(22,242 Views)
This is great stuff tst!  You can find a running document containing all of the old nuggets, both Darren's and the Champions' here!  I'll update this document each week with a link to the newest nugget.

Thanks,
Message 2 of 13
(22,202 Views)

Nice work, Jeffrey.

A couple of notes:

  • These nuggets will not necessarily be weekly. They might be less frequent, since we don't have a proper scheduling system.
  • This is not an LV champions endeavour. Ben can be credited with starting and pushing this, but anyone can participate (yes, even you). I am not a champion and I've already done more nuggets than anyone else. Smiley Very Happy

P.S. Are you Philip's replacement now?


___________________
Try to take over the world!
0 Kudos
Message 3 of 13
(22,188 Views)

Nice tips!  I only just learned some of those things a few weeks ago when I posed a very similar question on the LAVA forums.  Specifically, by placing the cursor at the "Max" end of the scale, you can drag it around until it coincides with the "Min" end.  The usefulness is for displaying the position of a rotary encoder on a spinning shaft.  Now that I know how to remove the gap between 360 and 0 points, it's very easy to indicate a spinning shaft.  I just read the (scaled) encoder angle out of DAQmx, perform a modulus with 360 deg, and wire to the guage.  Now the needle spins around continuously, just like the shaft it indicates.

BTW, I haven't found out how to control the amount that the whole dial gets rotated.  I would typically want my 0 position to be at either N,W,E, or W but I've had to rely on touch to try to get it there by mouse alone.  I didn't see a setting when I right-clicked for the properties pages.  (Admittedly, I haven't yet scoured all the object properties using a block diagram property node.)

-Kevin P.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 13
(22,144 Views)


@Kevin Price wrote:

I only just learned some of those things a few weeks ago when I posed a very similar question on the LAVA forums.


I believe that was how I got the inspiration to do this nugget.


BTW, I haven't found out how to control the amount that the whole dial gets rotated.  I would typically want my 0 position to be at either N,W,E, or W but I've had to rely on touch to try to get it there by mouse alone. 

I don't think you can control the position through any other means other than using the mouse.

___________________
Try to take over the world!
Message 5 of 13
(22,132 Views)
I recall doing the rotating dial trick years ago in version 6, to simulate a peristaltic pump. I had three dots as dials, and they rotated to give an indication of speed. However, I found that updating this pretty graphic caused my program to be sluggish, so I took it out later, much to the chagrin of those using the program. Version 6 was before precise timed loops and event structures - I should give it another try. Smiley Indifferent
Richard






Message 6 of 13
(22,099 Views)
The whole dial rotation appears to be available (in 7.1 at least) in the properties at: Scale -> Scale Position -> Start.  It takes a number of radians, and rotates the zero position on the dial to that angle.

Joe Z.

Message Edited by Underflow on 02-05-2007 04:17 PM (for clarity, twice!)

Message Edited by Underflow on 02-05-2007 04:17 PM

Message 7 of 13
(22,093 Views)
Thank you for the good tips Tst! Incidentally I am on the same function at the moment. I set the range of my dial 0-360. But everytime i pass the "0" and "360" either clockwise or counter clockwise i get a jitter or wrong distance travelled. I am trying to measure the speed of the dial. Any idea to improve my VI to accurately give the correct distance travelled? Thank you very much.
0 Kudos
Message 8 of 13
(22,036 Views)

Nice Nugget tst!

who wrote;

"

I don't think you can control the position through any other means other than using the mouse.

"

 

to which Joe Z replied

"

the properties at: Scale -> Scale Position -> Start.  It takes a number of radians, and rotates the zero position on the dial to that angle.

"

Talk about Socratic method!

I had to try this (of course) and had a compass spinning in no time.

I am not a fan of chicken but I do love our "Nuggets".

Ben

If you have a Nugget you would like to present please post here to reserve your week!

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 13
(22,014 Views)

Yes, Joe, very nice. I actually saw these properties as I looked around for an answer to Kevin's question, but for some reason they didn't register as the answer.

Bong, I could only hava a very quick look at your VI and I'm not sure I understand exactly what you want to do, but I would suggest that you try getting rid of the local variables. If you want to be able to detect the needle shifting over the 0 mark, I think you have to check and see if the if the difference between the last value and the current value is less than -300 or so. Maybe someone with 8.2 can help you more if you provide more details.


___________________
Try to take over the world!
0 Kudos
Message 10 of 13
(21,968 Views)