Bar class

One column in a BarChart.

A single-value bar uses Bar.new with one value. For stacked bars, pass multiple values to Bar.stacked — segments paint bottom→top and each takes the next color from the chart's palette (or colors when explicitly provided).

Constructors

Bar(String label, num value, {Color? color})
A single-value bar.
const
Bar.stacked(String label, List<num> segments, {List<Color> colors = const []})
A stacked bar of segments (rendered bottom→top). Segment heights sum to determine the bar's total height, so an empty list is a bar of zero height. colors (optional) pairs each segment with an explicit color — by index, falling back to the chart's palette for any unspecified index.
const

Properties

color → Color?
Fill color for a single-value bar.
final
colors → List<Color>
Optional per-segment colors for stacked bars. Padded by the chart palette when shorter than segments.
final
hashCode → int
The hash code for this object.
no setterinherited
label → String
Bar label drawn below the column (when showLabels: true).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
segments → List<num>
Stacked segment values (bottom→top). Empty for single-value bars.
final
total → num
The bar's total magnitude — value for single bars, segment sum for stacked bars. Used for autoscale and the value label.
no setter
value → num?
The bar's single value; null for a stacked bar.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited