← Back to Docs
  • index.html
  • Clayground
  • Clayground.Lab
  • BudgetBar
  • Clayground 2026.7
  • BudgetBar QML Type

    Shows how one total splits into its parts. More...

    Import Statement: import Clayground.Lab

    Properties

    Detailed Description

    A stacked bar plus a legend, for the question every lab eventually asks: where does it all go? Volts around a loop, current at a junction, power in a machine, time in a frame budget - anything conserved that divides into shares. Seeing a share swallow the whole bar explains a fault faster than any number does.

    Example usage:

    import Clayground.Lab
    
    BudgetBar {
        width: 200
        unit: "V"
        segments: [
            { label: "lost in the cell", value: 4.4, color: "#c05621" },
            { label: "reaches the parts", value: 0.1, color: "#3e9b92" }
        ]
    }

    See also Plot2D and ParamPanel.

    Property Documentation

    decimals : int

    Digits shown per value. Defaults to 2.


    segments : var

    The shares, as [{label, value, color}].

    Values are absolute amounts; the bar normalizes them against their sum (or total, when the whole is known and larger).


    total : real

    The whole the shares are measured against.

    Defaults to the sum of the segment values; set it explicitly when part of the total is unaccounted for (the remainder is left blank).


    unit : string

    Unit appended to every value in the legend.