ChartState<T> class
Main state of the charts. Painter will use this as state and it will format chart depending on options.
itemOptions Contains all modifiers for separate bar item
behaviour How chart reacts and sizes itself
foregroundDecorations and backgroundDecorations decorations that aren't connected directly to the chart but can show important info (Axis, target line...)
More different decorations can be added by extending DecorationPainter
Constructors
-
ChartState({required ChartData<
T> data, required ItemOptions itemOptions, ChartBehaviour behaviour = const ChartBehaviour(), List<DecorationPainter> backgroundDecorations = const <DecorationPainter>[], List<DecorationPainter> foregroundDecorations = const <DecorationPainter>[]}) - Chart state constructor
-
ChartState.bar(ChartData<
T> data, {required BarItemOptions itemOptions, ChartBehaviour behaviour = const ChartBehaviour(), List<DecorationPainter> backgroundDecorations = const <DecorationPainter>[], List<DecorationPainter> foregroundDecorations = const <DecorationPainter>[]}) -
Create bar chart with background grid decoration
factory
-
ChartState.line(ChartData<
T> data, {required BubbleItemOptions itemOptions, ChartBehaviour behaviour = const ChartBehaviour(), List<DecorationPainter> backgroundDecorations = const <DecorationPainter>[], List<DecorationPainter> foregroundDecorations = const <DecorationPainter>[]}) -
Create line chart with foreground sparkline decoration and background grid decoration
factory
Properties
-
backgroundDecorations
→ List<
DecorationPainter> -
Decorations for chart background, the go below the items
final
- behaviour → ChartBehaviour
-
ChartBehaviour define how chart behaves and how it should react
final
-
data
→ ChartData<
T> -
ChartData data that chart will show
final
-
dataRenderer
→ ChartDataRendererFactory<
T?> -
How is data rendered on the screen, by default it uses ChartLinearDataRenderer
final
- defaultMargin ↔ EdgeInsets
-
Margin of chart drawing area where items are drawn.
getter/setter pair
- defaultPadding ↔ EdgeInsets
-
Padding is used for decorations that want other decorations to be drawn on them.
Unlike defaultMargin some decorations don't need to respect padding.
Sometimes decorations paint over this padding.
getter/setter pair
-
foregroundDecorations
→ List<
DecorationPainter> -
Decorations for chart foreground, they are drawn last, and the go above items
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- itemOptions → ItemOptions
-
ItemOptions define how to draw that data points into items on chart.
Subclasses you can use: BarItemOptions for bar-like items, BubbleItemOptions for bubble and dot items,
WidgetItemOptions for any kind widget that you provide.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
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
Static Methods
-
lerp<
T> (ChartState< T?> a, ChartState<T?> b, double t) → ChartState<T?> - For later in case charts will have to animate between states.