Gauge
Shows where a value sits in a range, like a fuel gauge.
In the Library: Components → Status · Needs PadCode Pro
#When to use it
Use a Gauge to show where a number sits within a range, like a fuel gauge: a battery level, glasses of water out of 8, a score out of 10. To show progress toward finishing, use a Progress Bar. To let people change the number, use a Slider.
#How to use it
- Add a Gauge. It starts at 0.6 on a range of 0 to 1, with the label "Level".
- Set Range, the smallest and the biggest value.
- Tap ⚡︎ next to Value and pick a number variable, or tap Formula….
- To change the label, select the Text inside it in Layers and edit its Content.
- Pick a look under Control → Style, like Accessory Circular for a small ring.
#Example
A water tracker has a Gauge with Range 0 to 8, Value linked to a Whole Number variable glasses, and its label changed to Water. A Button "Drink a glass" adds 1 to glasses, and the gauge fills up a step at a time.
#Good to know
- A Value outside Range is drawn at the nearest end. If the first number in Range is bigger than the second, the Gauge uses 0 to 1 instead.
- On the canvas, tapping the label selects the whole Gauge. Select the label in Layers.
- The versions in Made of with Value label or End labels add a Text for the value, and Texts for the lowest and highest values, which show depending on Style. Select them in Layers to change their words, or put an icon in their place.
#Add it
In the Library's Components tab, find Gauge under Status (or search for it) and either:
- Tap it. It goes inside the selected container, at the end; right after the selected view, if that isn't a container; or at the bottom of the screen when nothing is selected.
- Drag it onto the canvas, to exactly where you want it. A line shows where it will land.
#Made of
The Made of menu, at the top of its settings, picks which pieces it has. Switching keeps the settings the versions share.
- Value + Custom content (where it starts)
- Value + Custom content + Value label
- Value + Custom content + Value label + End labels
#Settings
In the Inspector's Style tab, top to bottom. Tap ⓘ next to a setting in the app for the same help.
#Gauge
| Setting | What it does | How you set it | Starts as |
|---|---|---|---|
| Value | The number it shows. Link it to a variable with ⚡︎ so it changes as the app runs. | Text box, or ⚡︎ to link a variable | 0.6 |
| Range | The smallest and the biggest value, like 0 to 100. | Text box, or ⚡︎ to link a variable | 0, 1 |
#Size & spacing
Shared with other views: see Size & spacing.
| Setting | What it does | How you set it | Starts as |
|---|---|---|---|
| Padding | Empty space around the view, inside its background. One number for every side, like 16. | Text box | None |
| Sides | Padding for one side only: T is the top, L the left, B the bottom, R the right. | Text box | — |
| Width | Auto fits the content. Fill takes all the room it can. Fixed sets an exact size in points. | Menu: Auto, Fill, Fixed (then a number) | Auto |
| Height | Auto fits the content. Fill takes all the room it can. Fixed sets an exact size in points. | Menu: Auto, Fill, Fixed (then a number) | Auto |
| Offset | Nudges the view X points right and Y points down, without moving anything around it. Negative numbers go left and up. | Text box | — |
#Look
Shared with other views: see Look.
| Setting | What it does | How you set it | Starts as |
|---|---|---|---|
| Background | A color behind the view. Add Padding so it doesn't hug the content. | Color menu, or the color wheel | None |
| Corners | Rounds the background's corners, in points. 12 is gently rounded; a big number makes a pill. | Text box | 0 |
| Border | A line around the view, in the color you pick. | Color menu, or the color wheel | None |
| Shadow | A soft shadow under the view, so it looks raised. | Switch | Off |
| Opacity | How solid the view is. All the way right is solid; all the way left is invisible. | Slider | 100% |
| Liquid Glass | Apple's glass look: the view blurs and reflects what's behind it. | Switch | Off |
#Control
Shared with other views: see Control.
| Setting | What it does | How you set it | Starts as |
|---|---|---|---|
| Style | The look iOS gives this control, like a filled or a plain button. Automatic lets iOS choose. | Menu: Automatic, Accessory Circular, Accessory Circular Capacity, Accessory Linear, Accessory Linear Capacity, Linear Capacity | Automatic |
| Accent | The color of the control's active parts, like a switch when it's on. | Color menu, or the color wheel | None |
| Size | How big the control is: small, regular, large or extra large. | Menu: Mini, Small, Regular, Large, Extra Large | Regular |
#Show & enable
Closed at first. Show when shows the view only while a condition is true; Disabled grays it out. See Show & enable.
#All modifiers
Closed at first. Lists the modifiers on this view, in order, and adds more. It starts with none. See Modifiers.