🌡️ Meter
The Meter widget is a highly flexible visualization tool used to display numerical data along a scale. While similar to the Gauge, the Meter is optimized for linear scales (like a thermometer) or simplified radial scales where multiple indicators are needed.
⚙️ Properties (Props)
The Meter configuration is defined by the MeterWidget interface. It focuses on the relationship between the raw value and the visual markers on the scale.
| Property | Type | Description |
|---|---|---|
| Value | number | The current position of the indicator. |
| Range | number | The Min and Max limits of the scale. |
| Indicator Type | Dropdown | Choose between a Needle, Line, or Arc indicator. |
| Tick Count | number | The number of major graduation marks to display. |
| Scale Angle | number | The degree of the arc (set to 0 for a linear/vertical meter). |
🛠 Indicator Types
The Meter can change its visual personality based on the indicatorType:
- Needle: A classic pointed hand that pivots from the center (best for radial layouts).
- Line: A simple bar that moves across the scale (best for linear or "ribbon" displays).
- Arc: A filling segment that follows the path of the scale, similar to a progress bar but with tick marks.
🎨 Scale Customization
In the Inspector Panel, you can define how the scale background appears:
- Ticks: Adjust the length and thickness of major and minor ticks.
- Labels: Choose whether to show numbers at each major tick and set their font style.
- Color Zones: You can define specific ranges (e.g., 0-70 Green, 70-90 Yellow, 90-100 Red) to provide instant visual context for the data.
⚡ Runtime API (Lua)
The Meter is designed to be updated frequently via the Logic and Events system.
-- Update the temperature reading
meter_temp:set_value(data.ambient_temp)
-- Dynamically change the scale range
-- Useful for zooming into a specific data window
meter_temp:set_range(20, 30)
-- Change the indicator color if a threshold is met
if meter_temp:get_value() > 28 then
meter_temp:set_style_indicator_color(0xFF0000)
end
Use the Gauge for complex automotive or industrial dials with high-detail needles. Use the Meter for simpler indicators, vertical/horizontal bars, or when you need to display multiple needles on a single scale.
🚀 Next Steps
- Gauge — For more complex, high-fidelity analog dials.
- Bar — A simpler progress-style indicator without a scale.
- Logic and Events — Learn how to smooth out needle movement using software filters.