DesignChart class

A cartesian chart (line, area, bars, a sparkline): the look draws series from the scales and ticks in builder's details; the chart picks points, says them, and springs from one set of data to the next.

Picking: a mouse shows the point nearest it along x (bars: the band under it), its series the nearest by y, and leaving clears it; a finger scrubs with a horizontal drag (a list still scrolls vertically) and lifting clears it; a tap holds the point until a tap elsewhere. Keys (a single tab stop): Left and Right the previous and next point along x as drawn (mirrored right to left), Up and Down the series above and below at that x, Home and End the first and last, Escape lets go; leaving the chart lets go too.

A screen reader hears semanticLabel, then the data in a sentence ("2 series, 12 points, Jan 2026 to Dec 2026, lowest 820, highest 1,640"; semanticSummary overrides it), or the picked point ("Mar 2026, Revenue: 1,240"); increase and decrease step through the points, series after series, each said, and "Show data table" (onShowTable) offers a DesignChartTable.

The chart fills the width it is given (300 when unbounded) and the height (half its width when unbounded).

DesignChart(semanticLabel: 'Revenue', series: const [DesignChartSeries(label: 'Revenue', points: [DesignChartPoint(0, 820), DesignChartPoint(1, 1240)])], builder: (context, chart) => CustomPaint(size: chart.size))
Inheritance

Constructors

DesignChart({Key? key, required List<DesignChartSeries> series, required DesignChartBuilder builder, required String semanticLabel, DesignChartXAxis xAxis = DesignChartXAxis.linear, List<String>? categories, EdgeInsetsGeometry padding = EdgeInsets.zero, bool yIncludesZero = true, int tickCount = 5, DesignChartFormat? formatX, DesignChartFormat? formatY, String? semanticSummary, ValueChanged<DesignChartPointRef?>? onActivePointChanged, VoidCallback? onShowTable, FocusNode? focusNode, bool autofocus = false, double dampingRatio = 1, double stiffness = 400})
A chart of series.
const

Properties

autofocus → bool
Whether the chart takes focus when it first shows.
final
builder → DesignChartBuilder
Draws the chart.
final
categories → List<String>?
A band axis's category names, by index; null: their numbers.
final
dampingRatio → double
The damping of the spring a data change runs on (critically damped, 1, under Reduce Motion). Defaults to 1.
final
focusNode → FocusNode?
The chart's focus; null: its own. A node given is never disposed here.
final
formatX → DesignChartFormat?
The x values' labels, readout and speech; null: the scale's own (the reader's numbers, dates, or categories).
final
formatY → DesignChartFormat?
The y values' labels, readout and speech; null: the reader's numbers.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onActivePointChanged → ValueChanged<DesignChartPointRef?>?
Called as the picked point changes (null: none), for a readout elsewhere or a linked chart.
final
onShowTable → VoidCallback?
Shows the data as a table: offered to a screen reader as "Show data table". Null: not offered.
final
padding → EdgeInsetsGeometry
The room kept round the plot for the look's axes and labels; start and end follow the reader's direction.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String
The chart's name, said first ("Revenue by month").
final
semanticSummary → String?
What a screen reader hears of the data; null: a sentence built from it.
final
series → List<DesignChartSeries>
The data, each series in order along x.
final
stiffness → double
The stiffness of that spring. Defaults to 400.
final
tickCount → int
About how many ticks each axis has.
final
xAxis → DesignChartXAxis
What the x values are. Defaults to numbers.
final
yIncludesZero → bool
Whether the y scale reaches 0. Defaults to true (bars and areas stand on it).
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DesignChart>
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.
override
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