Hello everyone,
The HorizontalGauge is a neat control but it displays so small, with a tiny font size. Is there any way to make it bigger?
Gregory
Hello everyone,
The HorizontalGauge is a neat control but it displays so small, with a tiny font size. Is there any way to make it bigger?
Gregory
When in doubt always check the Options:
In[9]:= Options[HorizontalGauge]
Out[9]= {AlignmentPoint -> Center, AspectRatio -> Automatic,
Axes -> False, AxesLabel -> None, AxesOrigin -> Automatic,
AxesStyle -> {}, Background -> None, BaselinePosition -> Automatic,
BaseStyle -> {}, ColorOutput -> Automatic,
ContentSelectable -> Automatic, CoordinatesToolOptions -> Automatic,
DisplayFunction :> $DisplayFunction, Epilog -> {},
FormatType :> TraditionalForm, Frame -> False, FrameLabel -> None,
FrameStyle -> {}, FrameTicks -> Automatic, FrameTicksStyle -> {},
GaugeFaceElementFunction -> Automatic, GaugeFaceStyle -> Automatic,
GaugeFrameElementFunction -> Automatic, GaugeFrameSize -> Automatic,
GaugeFrameStyle -> Automatic, GaugeLabels -> None,
GaugeMarkers -> Automatic, GaugeStyle -> Automatic,
GridLines -> None, GridLinesStyle -> {}, ImageMargins -> 0.,
ImagePadding -> All, ImageSize -> Small, ImageSizeRaw -> Automatic,
LabelStyle -> {}, Method -> Automatic,
PerformanceGoal :> $PerformanceGoal, PlotLabel -> None,
PlotLegends -> None, PlotRange -> All, PlotRangeClipping -> False,
PlotRangePadding -> Automatic, PlotRegion -> Automatic,
PreserveImageOptions -> Automatic, Prolog -> {}, RotateLabel -> True,
ScaleDivisions -> Automatic, ScaleOrigin -> Automatic,
ScalePadding -> Automatic, ScaleRanges -> Automatic,
ScaleRangeStyle -> Automatic, ScalingFunctions -> None,
TargetUnits -> Automatic, Ticks -> Automatic, TicksStyle -> {}}
So here is a possibility:
HorizontalGauge[55, {0, 100}, ImageSize -> 400, BaseStyle -> 14]
Excellent tip! Thank you, David. In experimenting with these options, there are three other things that I have not been able to do.
Display the maximum value of the scale as the last tick when the maximum value is not divisible by 10. I have a scale that runs from 0 to 156. No matter how I set ScaleDivisions, I cannot get 156 to appear as the last tick. The best I can do is 150.
I cannot get the selected value to display above the marker, that is, move along with the marker. I tried
GaugeLabels → Placed[“Value”, Dynamic]
but that is incorrect.
Any thoughts?
Gregory
This helps with some of your requirements (skipping the placement of the value above the triangle) and substitutes your requirement for a value of 156 to appear as a ScaleDivisions with the behavior of not going above 156 (similar with not going below 12 at the other end):
HorizontalGauge[
Dynamic[x, (x = Which[# < 12, 12, # > 156, 156, True, #]) &], {0,
160}, ImageSize -> 500, BaseStyle -> 11,
GaugeLabels -> Placed[Dynamic[x], Above], ScaleDivisions -> 17]
The need to have the GaugeMarkers comprise of a triangle with the value above it can be done with a custom version. Here it uses a disk, following the documentation example in the documentaiton for GaugeMarkers-- it can be reworked to use a downward pointing triangle though (but which I am going to leave to you to work out
)…
Module[{marker},
marker[{{xmin_, xmax_}, {ymin_, ymax_}}, value_,
meta_] := {Text[
Style[value, 11, Black], {Mean[{xmin, xmax}], ymax + ymax/2}],
Disk[{Mean[{xmin, xmax}], Differences[{ymin, ymax}][[1]]/2}, .015]};
HorizontalGauge[
Dynamic[x, (x = Which[# < 12, 12, # > 156, 156, True, #]) &], {0,
160}, ImageSize -> 500, BaseStyle -> 11, ScaleDivisions -> 17,
GaugeMarkers -> marker]
]
Very cool. I learned a lot from this.
Thanks once again, David.
Gregory