« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Gauges
Cylinder Gauges
In[1]:=
X
styleopts = {GaugeFrameElementFunction -> Function[{arg, other}, {Rectangle[arg[[All, 1]], arg[[All, 2]], RoundingRadius -> Offset[10]]}], GaugeFrameStyle -> GrayLevel[.7], GaugeFrameSize -> .02, GaugeMarkers -> "CylinderMarker", GaugeStyle -> {Green, Black}, ScaleDivisions -> None, ScalePadding -> {{.2, .75}, {.2, .25}}, GaugeFaceStyle -> Graphics[ GraphicsGroup[ GeometricTransformation[{Thickness[0.05], CapForm["Butt"], Line[{{-0.57, -0.035}, {-0.4, -0.035}, {-0.3, -0.035}, {-0.2, \ -0.035}, {-0.08, -0.035}, {0.01, -0.035}}, VertexColors -> {GrayLevel[0.2], GrayLevel[1], GrayLevel[0.7], GrayLevel[0.4], GrayLevel[0.2], GrayLevel[0.4]}], Line[{{-0.37, 1.085}, {-0.3, 1.085}, {-0.27, 1.085}, {-0.24, 1.085}, {-0.22, 1.085}, {-0.18, 1.085}}, VertexColors -> {GrayLevel[0.2], GrayLevel[1], GrayLevel[0.7], GrayLevel[0.4], GrayLevel[0.2], GrayLevel[0.4]}], Line[{{-0.57, 1.025}, {-0.4, 1.025}, {-0.3, 1.025}, {-0.2, 1.025}, {-0.08, 1.025}, {0.01, 1.025}}, VertexColors -> {GrayLevel[0.2], GrayLevel[1], GrayLevel[0.7], GrayLevel[0.4], GrayLevel[0.2], GrayLevel[0.4]}], {GrayLevel[0.9], Thickness[0.01], Line[{{-0.57, -0.005}, {-0.4, -0.005}, {-0.3, -0.005}, \ {-0.2, -0.005}, {-0.1, -0.005}, {0.01, -0.005}}], Line[{{-0.57, 1.055}, {-0.4, 1.055}, {-0.3, 1.055}, {-0.2, 1.055}, {-0.1, 1.055}, {0.01, 1.055}}], Line[{{-0.37, 1.115}, {-0.3, 1.115}, {-0.27, 1.115}, {-0.24, 1.115}, {-0.22, 1.115}, {-0.18, 1.115}}]}}, {{{1, 0}, {0, 1}}, {0, 0}}]], PlotRangeClipping -> True, PlotRangePadding -> None], Method -> {"MarkerSize" -> 15}};
Create custom gauges for specific applications.
In[2]:=
X
BatteryGauge[fill_, opts___] := VerticalGauge[fill, {0, 100}, opts, styleopts]
In[3]:=
X
Grid[Partition[Table[BatteryGauge[i], {i, 100, 0, -12.5}], 3]]
Out[3]=