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: 

how do sliders work?

Hi ,
 
Please tell me how can I get slider function which will show me different colours for 3 different ranges i.e. if x> 5 : colur = red ,if x = 5 : colour = green and if x< 5 :colur = blue.
I want to show this as a horizontal bar which should slide the colurs for these 3 ranges .I am attaching a file to show how i am looking for the slider functionality to be incorporated in my vi.
 
Thanks & regards !
Sarita
0 Kudos
Message 1 of 4
(2,506 Views)
Assuming an event-driven interface, you could do something like the attached. Run the VI and then drag the slider up and down.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Download All
0 Kudos
Message 2 of 4
(2,495 Views)

There are a few issues with your problem description.

  • I assume you want an indicator, since it x>5 and x<5 are ambiguous and x=5 is an infinitely narrow range. You can use a slider with three text labels. Then add two extra hidden sliders to fill the background ranges.
  • If you are looking for a control, you can simplify Mike's idea by thresholding into an array of limits and then indexing into a color array. This eliminates all these stacked case structures and makes the code more maintainable. (e.g. it is easy to change one of the colors or limits without flipping through cases). 

The attached simple program (LV 8.0) shows both possibilities. Maybe you can adapt some of the ideas to your needs. 🙂

Also note that comparing DBLs is sometimes problematic. You might want to use integers for the slider.

 

Message Edited by altenbach on 06-02-2007 09:41 AM

Download All
0 Kudos
Message 3 of 4
(2,484 Views)
... of course the label for the blue area should be "             X<5". Sorry for the typo. 😉
 
(notice that I inserted extra spaces to better center the label on the color ranges)
0 Kudos
Message 4 of 4
(2,475 Views)