BarSeries class
Bars anchored at each data point's x value.
Data points are usually BarPoints (floating fromY, per-point style);
plain ChartPoints also work and paint as zero-based bars in the series
style. Gap points paint nothing but keep their slot addressable.
Alignment recipes
There is no alignment enum: bars are anchored at data values, so
alignment is a property of the x values plus the axis range. Each of the
usual alignments is a range recipe. For N bars at x = 0..N-1:
spaceAround/spaceEvenly— give every bar an equal slot with a half-slot margin at each plot edge:NumericAxis(range: AxisRange.fixed(-0.5, N - 0.5)). Nothing clips; this is the usual look for a categorical month/day strip.spaceBetween— pin the first and last bar centers to the plot edges:NumericAxis(range: AxisRange.fixed(0, N - 1)). The outer bars straddle the edges, so their outer halves clip.center— shrink the fixed range's padding around the same x values, e.g.AxisRange.fixed(-2, N + 1)leaves 1.5 empty slots per side; grow the numbers to push the group tighter into the middle.
Bar thickness is chosen independently of the recipe: BarWidth.pixels
for a fixed thickness, or BarWidth.xSpan to fill a fraction of
each slot (e.g. BarWidth.xSpan(0.6) on unit-spaced data) so bars scale
with the plot instead of the range. On a scrollable axis
(AxisResolution.perUnit) there is no alignment to pick — the range
follows the scroll position and BarWidth.xSpan keeps bar-to-gap
proportion constant at any resolution.
For side-by-side grouped bars, combine any recipe with xOffsetPx and barClusterOffset.
- Inheritance
-
- Object
- ChartSeries
- BarSeries
- Annotations
Constructors
Properties
-
data
→ List<
ChartPoint> ? -
Inline data; kept in x-ascending order internally. Null when data is fed
through the controller (live/lazy charts).
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Identifies the series in the controller's data store.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → BarStyle
-
Default visuals; each BarPoint.style overrides field-by-field
(see BarStyle.mergeOver).
final
- width → BarWidth
-
Default thickness when neither the point's style nor style specifies
one.
final
- xOffsetPx → double
-
Horizontal pixel shift of every bar off its x value — the grouping
primitive: N series over the same x values, each with its own offset,
form side-by-side clusters. See barClusterOffset.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paint(
ChartPaintContext context, SeriesRenderSnapshot snapshot) → void -
Paints the series' visible slice, after behind-series decorations and
before above-series decorations, in the order series are listed. May
publish paint products on
snapshot(see SeriesRenderSnapshot.geometry) for decorations painted above.override -
paintOutsidePlot(
ChartPaintContext context, SeriesRenderSnapshot snapshot) → void -
A second paint pass, running after every series and decoration has
painted — e.g. an endpoint badge that must sit above other series, not
just above its own. Default: nothing.
inherited
-
pixelOverhang(
ResolvedAxis xAxis) → double -
A bar's rectangle reaches half a bar width past its anchor, plus the
whole-series xOffsetPx shift.
override
-
snap(
SnapContext context) → SnappedPoint? -
Clustered bars snap in visual space: the query shifts by xOffsetPx
before the nearest-x lookup and the marker lands on the bar's drawn
center — so in a grouped chart the tracker line pins to the bar nearest
the pointer, not to the shared anchor between the cluster's bars.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
trackballMarkerColor(
ChartPoint point) → Color? -
Color for the default trackball marker snapped to
point; null usesTrackballBehavior.lineColor. Default: null.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited