is_eq : _
Compare the encoded trace, including input order and all style settings.
Bar :: # (opaque)
A validated Plotly bar trace.
is_eq : _
Compare the encoded trace, including input order and all style settings.
Validate the width and construct one bar trace.
Returns InvalidBarWidth(width) for a negative width, or NaN,
Infinity, or NegativeInfinity for a nonfinite width. Coordinates
are already checked by their opaque type; values and colors retain
input order. Use Bar(trace) to include the result in Chart.Props.
expect {
bars = Bar.new({ data: [{ x: "Apples", y: 3 }], name: "Sales" })?
Chart.new({ traces: [Bar(bars)] }).to_json().contains("Sales")
}
to_json_value : Bar -> InternalJson
Internal composition hook used by Plume's renderers.
Applications normally use Bar.to_json for complete JSON text;
this returns the package's safe internal value without accepting raw JSON.
Serialize the trace as JSON.
:= { x : Coordinate, y : Coordinate, color : Color ?? Color.rgb({ red: 31, green: 119, blue: 180 }), base : [Origin, At(Coordinate)] ?? Origin }
One bar's axis coordinates and fill color.
x and y accept text or finite numeric Coordinate values. For
Vertical, x locates the bar and y gives its height; Horizontal
uses x for its length and y for its position. color sets this bar's
fill and defaults to Plotly blue. Point order is preserved.
base: Origin starts the bar at zero on its value axis. At(start)
starts it at start instead, so the bar spans from start to
start plus its length: a floating bar, or a timeline entry when
start comes from Coordinate.from_time and the length is a
duration in milliseconds on a date axis.
:= {
data : List(Point),
orientation : [Vertical, Horizontal] ?? Vertical,
name : Str ?? "",
width : F64 ?? 0.75,
}
The complete bar series.
data contains bars in display order; an empty list is valid.orientation defaults to Vertical; Horizontal swaps axis roles.name is the legend/hover label, and may be empty.width is measured in position-axis units, defaults to 0.75, and may exceed one. It must be finite and nonnegative; zero hides bars.When every bar shares a color or base, the output holds that value
once instead of repeating it for each bar. Use Layout.Props's
bar_mode to group, stack or overlay several bar traces.