ChartAxis class

An axis: a line, tick marks and one label widget per tick.

Put it in a side slot of a Chart. Labels are real widgets — pass a labelBuilder to show icons, chips or multi-line text — and they are built only for the ticks that are visible, only when the set of ticks changes. While the chart is panned they slide without being rebuilt.

The axis sizes itself from its labels (extent), which is how the chart decides how wide the gutter is.

Inheritance

Constructors

ChartAxis({Key? key, Object? scale, ChartAxisExtent extent = const ChartAxisExtent.auto(), ChartTickLabelBuilder? labelBuilder, ChartTickFormatter? format, ChartTicks? ticks, Widget? prototype, List<Widget> markers = const <Widget>[], double tickLength = 4, double minorTickLength = 2, double labelGap = 4, double labelSpacing = 6, bool showLine = true, bool showLabels = true, Color? color, TextStyle? labelStyle})
Creates an axis for scale. By default, axes docked left or right show the y scale and axes docked above or below show the x scale.
const

Properties

color → Color?
Colour of the line and tick marks. Defaults to the chart theme.
final
extent → ChartAxisExtent
How thick the axis is.
final
format → ChartTickFormatter?
Text for the default labels.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelBuilder → ChartTickLabelBuilder?
Builds the widget for a tick. Defaults to a Text of the tick's label.
final
labelGap → double
Gap between tick marks and labels.
final
labelSpacing → double
Minimum room between neighbouring labels; closer labels are hidden.
final
labelStyle → TextStyle?
Text style merged into the theme's label style.
final
markers → List<Widget>
Widgets pinned to values along the axis, usually ChartAxisMarkers.
final
minorTickLength → double
Length of the marks at minor ticks. 0 draws none. There are minor ticks only when the ticks of the scale, or ticks, have them: see LinearTicks.minorCount.
final
prototype → Widget?
A widget as large as the largest expected label. The axis reserves room for it, which keeps the gutter from changing as labels come and go.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scale → Object?
Id of the scale to show.
final
showLabels → bool
Whether tick labels are shown.
final
showLine → bool
Whether the axis line is drawn.
final
tickLength → double
Length of tick marks. 0 draws none.
final
ticks → ChartTicks?
Tick strategy for this axis only. Prefer setting ticks on the scale, so grid lines agree with the axis.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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