Skip to content

Bar Chart

Vertical bar chart with labeled bars, optional per-bar colors, and value labels.

lua
ui:element({
    id = "atmos_bars", type = "barchart",
    rect = { unit = "px", x = 10, y = 50, w = 300, h = 100 },
    props = {
        labels = { "O2", "N2", "CO2", "H2O" },
        values = { 21.1, 78.1, 0.04, 1.2 },
        colors = { "#3B82F6", "#6366F1", "#EF4444", "#06B6D4" },
        max = 100,
    },
    style = {
        bg = "#111827",
        font_size = 9,
        gap = 4,
        show_values = "true",
    }
})
PropDescription
labelsArray of bar labels
valuesArray of float values
colorsArray of hex colors per bar (cycles if fewer)
minMinimum value (default 0)
maxMaximum value (auto-detected if omitted)
StyleDescription
bgBackground color
bar_colorDefault bar color (when colors not set)
label_colorLabel text color
value_colorValue text color above bars
font_sizeLabel/value font size
gapGap between bars in pixels (default 4)
show_values"true" to show value labels above bars

⚠️ This documentation was AI-generated and may contain inaccuracies. Please submit pull requests with corrections as needed.