Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to have the value for a vertical slider display next to the indicator arrow for a vertical slider. However, my attempt is slightly wrong; the coordinates are scaled to the entire frame of the vertical slider (and not the coordinates), so at the minimum and maximum values, the location of the label is slightly off.

How can I get this to work correctly? When I don't use Scaled, the label goes way off of the vertical slider, but when I do used it, it scales to the wrong values.

Code:

Manipulate[
 Grid[{
   {
    Style[" Sample ", 12, Bold, Underlined]},
   {VerticalGauge[length, {0, 100},
     GaugeFaceStyle -> LightGray,
     GaugeLabels -> Placed[Automatic, Scaled[{0, length/100}]]
     ]
    }
   },
  Alignment -> Center],
 {length, 0, 100}
 ]

Imgur

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The padding is approximately eight percent both at the top and the bottom, so this will work pretty good:

Scaled[{0, 0.08 + 0.84 length/100}]

To understand how I got it, try substituting 0 and 100 respectively for length.

share|improve this answer
    
thank you very much! that works great for the sample, I'll have to make a few tweaks to get it working for different scales but the concept is great, thanks again! –  madacho Jan 22 at 22:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.