ChartAxisConfig class

Describes one axis on a chart (X or Y).

Constructors

ChartAxisConfig({AxisScaleType scaleType = AxisScaleType.linear, AxisPosition position = AxisPosition.left, String? label, double? min, double? max, int tickCount = 5, double logBase = 10, List<String>? categories, String tickFormatter(double value)?, String timeFormatter(DateTime dt)?, bool showAxisLine = true, bool showTicks = true, bool showGrid = true, bool showLabels = true, bool inverted = false})
const
ChartAxisConfig.category({AxisPosition position = AxisPosition.bottom, required List<String> categories, String? label, bool showGrid = false})
const
ChartAxisConfig.fromJson(Object? raw)
factory
ChartAxisConfig.linear({AxisPosition position = AxisPosition.left, double? min, double? max, int tickCount = 5, String? label, bool showGrid = true})
const
ChartAxisConfig.log({AxisPosition position = AxisPosition.left, double? min, double? max, double logBase = 10, String? label})
const
ChartAxisConfig.percent({AxisPosition position = AxisPosition.left, String? label})
const
ChartAxisConfig.time({AxisPosition position = AxisPosition.bottom, double? min, double? max, int tickCount = 6, String? label})
const

Properties

categories List<String>?
Discrete category labels, ordered. Required when scaleType == AxisScaleType.category.
final
hashCode int
The hash code for this object.
no setterinherited
inverted bool
Whether to invert the axis direction.
final
label String?
Human-readable axis label (optional).
final
logBase double
If scaleType is AxisScaleType.log, the logarithm base (default 10).
final
max double?
Override maximum value. If null, computed from data.
final
min double?
Override minimum value. If null, computed from data.
final
position AxisPosition
Where this axis is rendered.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleType AxisScaleType
Axis scaling algorithm.
final
showAxisLine bool
Whether to show the axis line.
final
showGrid bool
Whether to show grid lines projected from this axis.
final
showLabels bool
Whether to show axis label text.
final
showTicks bool
Whether to show tick marks.
final
tickCount int
Number of tick marks. Ignored for AxisScaleType.category.
final
tickFormatter String Function(double value)?
Custom tick formatter. If null, a sensible default is used.
final
timeFormatter String Function(DateTime dt)?
Custom tick formatter for DateTime ticks (used with AxisScaleType.time).
final

Methods

computeTicks(double dataMin, double dataMax) List<double>
Generate tick values in data space.
formatTick(double value) String
Format a tick value as a display string.
normalize(double value, double dataMin, double dataMax) double
Convert a raw data value to 0..1 normalised.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

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