StackedAreaChart class

A scrollable stacked area chart widget for displaying cumulative data.

StackedAreaChart visualizes multiple data series as stacked filled areas, showing how individual components contribute to a total over time. It features smooth scrolling, animations, and extensive styling options.

Example:

StackedAreaChart(
  data: StackedAreaChartData(
    labels: [
      ChartLabel(label: 'Q1'),
      ChartLabel(label: 'Q2'),
      ChartLabel(label: 'Q3'),
    ],
    areas: [
      ChartArea(
        label: 'Product A',
        color: Colors.blue.withOpacity(0.7),
        points: [
          DataPoint(labelIndex: 0, value: 500),
          DataPoint(labelIndex: 1, value: 700),
          DataPoint(labelIndex: 2, value: 600),
        ],
      ),
    ],
  ),
  visibleLabels: 3,
)
Inheritance

Constructors

StackedAreaChart({Key? key, required StackedAreaChartData data, int visibleLabels = 3, SelectedPointerStyle? selectedPointerStyle, GridLinesStyle? gridLinesStyle, CumulativeLabelStyle? cumulativeLabelStyle, DataMarkerStyle? dataMarkerStyle, ZeroLineStyle zeroLineStyle = const ZeroLineStyle(), XAxisStyle xAxisStyle = const XAxisStyle(), XAxisLabelStyle xAxisLabelStyle = const XAxisLabelStyle(), LabelTransformer labelTransformer = defaultLabelTransformer, MissingDataBehavior missingDataBehavior = MissingDataBehavior.zero, YAxisAnimationConfig yAxisAnimationConfig = YAxisAnimationConfig.smooth, ScrollPhysicsConfig scrollPhysicsConfig = ScrollPhysicsConfig.smooth, OnVisibleRangeChanged? onVisibleRangeChanged, OnSelectedChanged? onSelectedChanged, int? initialIndex})
const

Properties

cumulativeLabelStyle → CumulativeLabelStyle?
Style for the cumulative value labels at the top of each stack.
final
data → StackedAreaChartData
The data to display in the chart.
final
dataMarkerStyle → DataMarkerStyle?
Style for the data point markers.
final
gridLinesStyle → GridLinesStyle?
Style for the vertical grid lines.
final
hashCode → int
The hash code for this object.
no setterinherited
initialIndex → int?
Initial index to display when the chart loads.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelTransformer → LabelTransformer
Function to transform numeric values to strings for cumulative labels. Defaults to defaultLabelTransformer.
final
missingDataBehavior → MissingDataBehavior
How to handle missing data points. Defaults to MissingDataBehavior.zero.
final
onSelectedChanged → OnSelectedChanged?
Callback when the selected data point changes.
final
onVisibleRangeChanged → OnVisibleRangeChanged?
Callback when the visible range of data points changes.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollPhysicsConfig → ScrollPhysicsConfig
Configuration for scroll snap physics.
final
selectedPointerStyle → SelectedPointerStyle?
Style for the selected pointer vertical line.
final
visibleLabels → int
Number of data points visible at once. Defaults to 3.
final
xAxisLabelStyle → XAxisLabelStyle
Style for the X-axis labels.
final
xAxisStyle → XAxisStyle
Style for the X-axis line.
final
yAxisAnimationConfig → YAxisAnimationConfig
Configuration for Y-axis range animations.
final
zeroLineStyle → ZeroLineStyle
Style for the zero line (horizontal line at y=0).
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<StackedAreaChart>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

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