1
$\begingroup$

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

$\endgroup$
4
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ 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! $\endgroup$ – madacho Jan 22 '14 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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