📊 Bar
The Bar widget is a linear visual indicator used to represent progress, volume, or any numeric scale. Unlike the Slider, the Bar is primarily used for output display rather than user input.
⚙️ Properties (Props)
The Bar behavior is defined by the BarWidget interface. It supports advanced filling modes to accommodate various types of data visualization.
| Property | Type | Description |
|---|---|---|
| Value | number | The current end position of the indicator. |
| Value Start | number | The starting position (only used in Range mode). |
| Range | number | The Min and Max limits (e.g., 0 to 100). |
| Mode | Dropdown | Determines how the bar fills (Normal, Symmetrical, or Range). |
🛠 Operation Modes
The Bar widget adapts its visual logic based on the mode property:
- Normal: The indicator grows from the
rangeMinvalue toward the currentvalue. - Symmetrical: The indicator grows from a zero point. This is ideal for values that can be both positive and negative (e.g., -50 to +50).
- Range: The indicator is drawn specifically between
valueStartandvalue. This is useful for representing a specific "active zone" or buffer.
🎨 Visual Styling
A Bar consists of two main style layers in the Inspector Panel:
- Main (Background): The container representing the full potential range.
- Indicator (Foreground): The part of the bar that fills up based on the data.
⚡ Runtime API (Lua)
The Bar is frequently updated via system variables or communication protocols.
-- Update a standard progress bar
bar_progress:set_value(75)
-- In Range mode, set both the start and end points
bar_buffer:set_value_start(10)
bar_buffer:set_value(45)
-- Adjust color based on critical levels
if bar_battery:get_value() < 20 then
bar_battery:set_style_bg_color(0xFF0000) -- Red for low battery
end
PERFORMANCE
Bars are extremely lightweight on memory. For simple status indicators (like signal strength or battery), the Bar widget is more efficient than using multiple static images.