Stack<K, T> class Stacks

Stacking converts lengths into contiguous position intervals.

For example, a bar chart of monthly sales might be broken down into a multi-series bar chart by category, stacking bars vertically and applying a categorical color encoding. Stacked charts can show overall value and per-category value simultaneously; however, it is typically harder to compare across categories as only the bottom layer of the stack is aligned. So, chose the stack order carefully, and consider a streamgraph (see stackOffsetWiggle). (See also grouped charts.)

Like the Pie generator, the stack generator does not produce a shape directly. Instead it computes positions which you can then pass to an Area generator or use directly, say to position bars.

Constructors

Stack.new(num value(T, K, int, Iterable<T>))
Constructs a new stack generator with the given value accessor.
Stack.withConstants(num value)
Constructs a new stack generator with the given value number.

Properties

hashCode int
The hash code for this object.
no setterinherited
keys List<K> Function(Stack<K, T>, Iterable<T>, [List<Object?>?])
The keys accessor;
getter/setter pair
offset ↔ void Function(List<List<List<num>>>, List<int>)
Given the generated series list and the order index list, it is then responsible for updating the lower and upper values in the series list.
getter/setter pair
order Iterable<int> Function(List<List<List<num>>>)
Given the generated series list, it must return an list of numeric indices representing the stack order.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value num Function(T, K, int, Iterable<T>)
The value accessor.
getter/setter pair

Methods

call(Iterable<T> data, [List<Object?>? args]) List<StackSeries<K, T>>
Generates a stack for the given list of data and returns an list representing each series.
constKeys(List<K> keys) → void
Defines the Stack.keys-accessor as a constant function that always returns the specified value.
constValue(num value) → void
Defines the Stack.value-accessor as a constant function that always returns the specified value.
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

Static Methods

withDefaults<K>([num value(Map<K, num>, K, int, Iterable<Map<K, num>>)?]) Stack<K, Map<K, num>>
Equivalent to Stack.new, except that if value is not specified, its default is used.