BarGroupInfo class

Metadata for positioning and composing a bar series within category slots.

When multiple bar slots share the same X-values, they need to be positioned side-by-side. Stacked series intentionally share a slot index while grouped series receive distinct indices.

Usage:

// For the second bar series out of three total bar series:
final groupInfo = BarGroupInfo(
  index: 1,
  count: 3,
  gap: 2.0,
);

// Calculate X-offset for a 20px wide bar
final offset = groupInfo.calculateOffset(20.0);

Immutability: All fields are final and the class has a const constructor.

See also:

  • SeriesElement, which stores bar group metadata during rendering
Annotations
  • @ChartSurfaceExempt.new('Render-time layout result, not an authoring config: the bar layout engine ' 'computes index/count and the stacked start, end and percentage maps per ' 'frame and hands them to the renderer. Consumers compose bars through ' 'BarChartSeries. index and count are additionally assert-coupled ' '(index < count), so individual setters could only build an invalid slot.')

Constructors

BarGroupInfo({required int index, required int count, double gap = 2.0, BarLayoutMode layoutMode = BarLayoutMode.grouped, String? groupId, double stackBaseline = 0.0, Map<int, double> startValues = const {}, Map<int, double> endValues = const {}, Map<int, double> percentages = const {}, Set<int> outerPointIndices = const {}, bool drawTrack = true})
Creates bar group positioning metadata.
const

Properties

count int
Total number of side-by-side category slots in the chart.
final
drawTrack bool
Whether this series owns the shared track behind its composition slot.
final
endValues Map<int, double>
Rendered segment end values keyed by point index.
final
gap double
Pixel spacing between adjacent bars within a group.
final
groupId String?
Named stack ID, when supplied by the series.
final
hashCode int
Returns a hash code based on index, count, and gap.
no setteroverride
index int
0-based index of this series' category slot.
final
isDiverging bool
no setter
isOverlaid bool
no setter
isStacked bool
no setter
isWaterfall bool
no setter
layoutMode BarLayoutMode
Composition mode resolved for this series.
final
outerPointIndices Set<int>
Point indices exposed at the positive or negative end of a stack.
final
percentages Map<int, double>
Signed normalized percentages keyed by point index.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stackBaseline double
Common baseline used by a stack.
final
startValues Map<int, double>
Rendered segment start values keyed by point index.
final

Methods

calculateOffset(double barWidth) double
Calculate the X-offset for this bar within its group.
copyWith({int? index, int? count, double? gap, BarLayoutMode? layoutMode, String? groupId, bool clearGroupId = false, double? stackBaseline, Map<int, double>? startValues, Map<int, double>? endValues, Map<int, double>? percentages, Set<int>? outerPointIndices, bool? drawTrack}) BarGroupInfo
Creates a copy with optional field overrides.
endValueFor(int pointIndex, double fallback) double
isOuterPoint(int pointIndex) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
percentageFor(int pointIndex) double?
startValueFor(int pointIndex, double fallback) double
toString() String
Returns a string representation of this BarGroupInfo.
override

Operators

operator ==(Object other) bool
Compares two BarGroupInfo instances for value equality.
override