|
| 1 | +--- |
| 2 | +name: Gauge Suite |
| 3 | +description: A collection of gauge, knob, thermostat, joystick, and display components for Dash. |
| 4 | +endpoint: /pip/dash_gauge |
| 5 | +package: dash_gauge |
| 6 | +icon: mdi:gauge # Or choose another icon e.g., akar-icons:gauge, fluent:gauge-24-regular |
| 7 | +--- |
| 8 | + |
| 9 | +.. toc:: |
| 10 | + |
| 11 | +[Visit GitHub Repo](https://github.com/pip-install-python/dash-gauge) |
| 12 | + |
| 13 | +### Installation |
| 14 | + |
| 15 | +```bash |
| 16 | +pip install dash-gauge |
| 17 | +``` |
| 18 | + |
| 19 | + |
| 20 | +### Introduction |
| 21 | + |
| 22 | +The `dash-gauge` package provides a suite of interactive and visually appealing components to enhance your Plotly Dash dashboards. Built as wrappers around popular React libraries, this collection includes: |
| 23 | + |
| 24 | +* **`DashGauge`**: Customizable gauge charts (Grafana, Semicircle, Radial styles). |
| 25 | +* **`DashRotaryKnob`**: Interactive rotary knob controls with various skins. |
| 26 | +* **`DashThermostat`**: A thermostat-like input component. |
| 27 | +* **`DashRCJoystick`**: A virtual joystick component for directional input. |
| 28 | +* **`Dash7SegmentDisplay`**: A classic 7-segment display for numbers and hex values. |
| 29 | + |
| 30 | +This page documents each component included in the suite. |
| 31 | + |
| 32 | +.. exec::docs.dash_gauge.introduction_example |
| 33 | + :code: false |
| 34 | + |
| 35 | +.. sourcetabs::docs/dash_gauge/introduction_example.py |
| 36 | + :defaultExpanded: false |
| 37 | + :withExpandedButton: true |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +### DashGauge |
| 42 | + |
| 43 | +Displays a value on a customizable gauge. Supports different styles, color ranges, sub-arcs, custom labels, and pointers. Ideal for visualizing KPIs, sensor readings, or progress metrics. |
| 44 | + |
| 45 | +.. exec::docs.dash_gauge.gauge_example |
| 46 | + :code: false |
| 47 | + |
| 48 | +.. sourcetabs::docs/dash_gauge/gauge_example.py |
| 49 | + :defaultExpanded: false |
| 50 | + :withExpandedButton: true |
| 51 | + |
| 52 | + |
| 53 | +#### DashGauge Props |
| 54 | + |
| 55 | +| Prop | Type | Default | Description | |
| 56 | +|-------------------|----------------------------|--------------|----------------------------------------------------------------------------------------------------------------------------------------------| |
| 57 | +| `id` | string | - | Component ID for Dash callbacks. | |
| 58 | +| `value` | number | `33` | The value the gauge should indicate. | |
| 59 | +| `type` | string | `'grafana'` | Style of the gauge. Choices: `'grafana'`, `'semicircle'`, `'radial'`. | |
| 60 | +| `minValue` | number | `0` | Minimum value of the gauge scale. | |
| 61 | +| `maxValue` | number | `100` | Maximum value of the gauge scale. | |
| 62 | +| `className` | string | `dash-gauge` | CSS class name for the component. | |
| 63 | +| `style` | object | `{}` | Inline CSS styles for the component. | |
| 64 | +| `marginInPercent` | number or object | `undefined` | Sets the margin for the chart inside the SVG. Can be a single number or `{top, bottom, left, right}`. | |
| 65 | +| `arc` | object | `{}` | Configuration for the gauge arc (e.g., `width`, `padding`, `cornerRadius`, `colorArray`, `subArcs`, `gradient`). See `usage_gauge.py` for details. | |
| 66 | +| `pointer` | object | `{}` | Configuration for the gauge pointer/needle (e.g., `type`, `color`, `length`, `width`, `animate`, `elastic`). See `usage_gauge.py` for details. | |
| 67 | +| `labels` | object | `{}` | Configuration for value and tick labels (e.g., `valueLabel`, `tickLabels`, `formatTextValue`, `hideMinMax`). See `usage_gauge.py` for details. | |
| 68 | +| `setProps` | func | - | Dash-assigned callback function. | |
| 69 | + |
| 70 | +**Note:** For detailed examples of `arc`, `pointer`, and `labels` configurations, please refer to the `usage_gauge.py` file in the GitHub repository. |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +### DashRotaryKnob |
| 75 | + |
| 76 | +An interactive knob component, useful for selecting values within a range (e.g., volume, tuning). Comes with multiple visual skins from the `react-rotary-knob-skin-pack`. |
| 77 | + |
| 78 | +.. exec::docs.dash_gauge.knob_example |
| 79 | + :code: false |
| 80 | + |
| 81 | +.. sourcetabs::docs/dash_gauge/knob_example.py |
| 82 | + :defaultExpanded: false |
| 83 | + :withExpandedButton: true |
| 84 | + |
| 85 | +#### DashRotaryKnob Props |
| 86 | + |
| 87 | +| Prop | Type | Default | Description | |
| 88 | +|-----------------|---------|-----------|------------------------------------------------------------------------------------------------------------| |
| 89 | +| `id` | string | - | Component ID for Dash callbacks. | |
| 90 | +| `value` | number | `0` | The current value of the knob. Updated via interaction or callbacks. | |
| 91 | +| `min` | number | `0` | Minimum value of the knob. | |
| 92 | +| `max` | number | `100` | Maximum value of the knob. | |
| 93 | +| `step` | number | `1` | Increment/decrement step size. | |
| 94 | +| `skinName` | string | `'s1'` | Selects the visual appearance (e.g., `'s1'`, `'s5'`, `'s10'`, up to `'s18'`). See repository for examples. | |
| 95 | +| `preciseMode` | boolean | `true` | If true, requires Shift key + drag for fine adjustments. | |
| 96 | +| `unlockDistance`| number | `0` | Degrees the mouse must move vertically to "unlock" the knob for rotation. | |
| 97 | +| `className` | string | `''` | CSS class name for the component. | |
| 98 | +| `style` | object | `{}` | Inline CSS styles for the component. | |
| 99 | +| `setProps` | func | - | Dash-assigned callback function. | |
| 100 | + |
| 101 | +**Note:** Explore all 18 skins by changing the `skinName` prop! See `usage_rotary_knob.py` for an interactive example. Only skins 1 & 10-15 look good 🤷 "no idea why the other skins don't alin correctly". |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +### DashThermostat |
| 106 | + |
| 107 | +A component mimicking a thermostat interface for setting a target value, typically temperature. |
| 108 | + |
| 109 | +.. exec::docs.dash_gauge.thermostat_example |
| 110 | + :code: false |
| 111 | + |
| 112 | +.. sourcetabs::docs/dash_gauge/thermostat_example.py |
| 113 | + :defaultExpanded: false |
| 114 | + :withExpandedButton: true |
| 115 | + |
| 116 | +#### DashThermostat Props |
| 117 | + |
| 118 | +| Prop | Type | Default | Description | |
| 119 | +|--------------|---------|-------------|---------------------------------------------------------------------------------------------------------| |
| 120 | +| `id` | string | - | Component ID for Dash callbacks. | |
| 121 | +| `value` | number | Required | The current set value (e.g., temperature). Updated via interaction or callbacks. | |
| 122 | +| `min` | number | `0` | Minimum value of the thermostat scale. | |
| 123 | +| `max` | number | `100` | Maximum value of the thermostat scale. | |
| 124 | +| `valueSuffix`| string | `'°'` | Text to display after the value (e.g., `'°C'`, `'°F'`, `'%`). | |
| 125 | +| `disabled` | boolean | `false` | If true, disables user interaction with the thermostat. | |
| 126 | +| `handle` | object | `undefined` | Configuration object for the draggable handle (e.g., `size`, `colors`). See `react-thermostat` docs. | |
| 127 | +| `track` | object | `undefined` | Configuration object for the background track (e.g., `colors`, `thickness`, `markers`). See `react-thermostat` docs. | |
| 128 | +| `className` | string | `''` | CSS class name for the component. | |
| 129 | +| `style` | object | `{}` | Inline CSS styles for the component. Note: Component has min-width/height defaults. | |
| 130 | +| `setProps` | func | - | Dash-assigned callback function. | |
| 131 | + |
| 132 | +**Note:** The `usage_thermostat.py` example demonstrates complex interaction with custom styling and mode switching. It may require CSS files placed in an `assets` folder. |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +### DashRCJoystick |
| 137 | + |
| 138 | +A virtual joystick component that reports direction, angle, and distance based on user interaction. Useful for controlling elements in simulations, games, or robotics dashboards. |
| 139 | + |
| 140 | +.. exec::docs.dash_gauge.joystick_example |
| 141 | + :code: false |
| 142 | + |
| 143 | +.. sourcetabs::docs/dash_gauge/joystick_example.py |
| 144 | + :defaultExpanded: false |
| 145 | + :withExpandedButton: true |
| 146 | + |
| 147 | +#### DashRCJoystick Props |
| 148 | + |
| 149 | +| Prop | Type | Default | Description | |
| 150 | +|----------------------|---------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------| |
| 151 | +| `id` | string | - | Component ID for Dash callbacks. | |
| 152 | +| `baseRadius` | number | `75` | Radius of the joystick's static base circle. | |
| 153 | +| `controllerRadius` | number | `35` | Radius of the movable controller knob. | |
| 154 | +| `directionCountMode` | string | `'Five'` | Determines the reported directions. Choices: `'Five'` (Center, Top, Bottom, Left, Right), `'Nine'` (includes diagonals). | |
| 155 | +| `insideMode` | boolean | `false` | If true, the controller knob stays within the base radius. | |
| 156 | +| `throttle` | number | `0` | Throttle time in milliseconds for `onChange` events. `0` means no throttle. | |
| 157 | +| `className` | string | `''` | CSS class name for the container. | |
| 158 | +| `style` | object | `{}` | Inline CSS styles for the container. | |
| 159 | +| `controllerClassName`| string | `undefined` | Additional CSS class for the controller knob. | |
| 160 | +| **Read-only Props** | | | *(These props are updated by the component and read in callbacks)* | |
| 161 | +| `angle` | number | `undefined` | [Readonly] Current angle of the joystick (degrees). `undefined` when centered. | |
| 162 | +| `direction` | string | `'Center'` | [Readonly] Current direction string (e.g., 'Top', 'BottomLeft', 'Center'). Possible values depend on `directionCountMode`. | |
| 163 | +| `distance` | number | `0` | [Readonly] Current distance of the controller from the center (normalized 0-1 based on `baseRadius`). | |
| 164 | +| `setProps` | func | - | Dash-assigned callback function. | |
| 165 | + |
| 166 | +**Note:** See `usage_rc_joystick.py` for an example controlling the joystick's appearance and reading its state. |
| 167 | + |
| 168 | +--- |
0 commit comments