I am trying to build a HorizontalGauge control for use in a Manipulate. The gauge should enable the user to select a day of the month. The following code seems to work fine (with one exception, noted below):
MyGauge :=
HorizontalGauge[
#1, #2,
GaugeFrameStyle -> Gray,
GaugeFaceStyle -> LightOrange,
(*GaugeLabels\[Rule]Automatic,*)
GaugeLabels -> Placed[#1, Above],
ScaleDivisions -> {8, 6}
] &;
Manipulate[
Floor[dim],
{{dim, 1, "Day in month"}, 1, 31, MyGauge}
]
This code successfully produces the following gauge:
The problem I am having relates to the label. Note that the value shown includes a fractional part, when I would really like to display just the integer part.
I have tried various workarounds:
- Use of GaugeLabels->Automatic (* Same value as above *)
- Explicit use of Floor[#1] (* Results in display of ⌊value⌋ *)
- Adding an explicit integer increment as a fourth arguments to the Manipulate control description (* Error *)
Note that the normal behavior of HorizontalGauges has the behavior I desire as the default:
HorizontalGauge[98.6, {0, 150}, GaugeLabels -> Automatic]
My question is: How can I produce a HorizontalGauge label that displays an integer version of its first argument? More generally, is it possible to display arbitrary functional transformations on the input arguments in the GaugeLabels?