LineChartData class
Complete data for rendering a line chart (single or multi-series).
The X axis supports two modes:
- Numeric mode (default): omit xLabels and the chart auto-generates numeric tick labels from minX–maxX.
- Categorical mode: provide xLabels and the chart renders them as evenly spaced string labels. Points are still positioned by LinePoint.x.
Legend. Pass legend entries explicitly, or leave it empty to
auto-derive entries from the series list. With multiple series
(point + function combined), the auto-derived legend contributes
one entry per series using its name and color; with one or
zero series, no auto-derived legend is rendered. See
ChartLegendEntries.fromLineChartData to obtain the auto-derived
list explicitly (e.g., for a standalone HandDrawnLegend).
Constructors
-
LineChartData({required List<
LineSeriesData> series, required double minX, required double maxX, required double minY, required double maxY, List<String> xLabels = const [], String? title, String? yAxisLabel, String? xAxisLabel, AxisValueFormatter? yValueFormatter, AxisValueFormatter? xValueFormatter, AxisDisplay axisDisplay = AxisDisplay.edge, List<FunctionSeriesData> functionSeries = const [], List<LegendEntry> legend = const []}) -
const
Properties
- axisDisplay → AxisDisplay
-
Axis display configuration. Defaults to edge-aligned axes. Set to
enable zero-crossing axes for charts with mixed positive/negative
values.
final
-
functionSeries
→ List<
FunctionSeriesData> -
Function-backed series. Each entry plots a mathematical function
across the numeric x-domain.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isEmpty → bool
-
no setter
-
legend
→ List<
LegendEntry> -
Custom legend entries.
final
- maxX → double
-
final
- maxY → double
-
final
- minX → double
-
final
- minY → double
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
series
→ List<
LineSeriesData> -
final
- title → String?
-
Optional chart title rendered above the chart area.
final
- xAxisLabel → String?
-
Optional X-axis title rendered below the X tick labels.
final
-
xLabels
→ List<
String> -
Categorical X-axis labels. When non-empty, these are rendered as
evenly spaced string labels instead of auto-generated numeric ticks.
final
- xValueFormatter → AxisValueFormatter?
-
Optional formatter for X-axis tick labels (numeric mode only).
final
- yAxisLabel → String?
-
Optional Y-axis title rendered rotated along the left edge.
final
- yValueFormatter → AxisValueFormatter?
-
Optional formatter for Y-axis tick labels.
final
Methods
-
copyWith(
{List< LineSeriesData> ? series, double? minX, double? maxX, double? minY, double? maxY, List<String> ? xLabels, String? title, String? yAxisLabel, String? xAxisLabel, AxisValueFormatter? yValueFormatter, AxisValueFormatter? xValueFormatter, AxisDisplay? axisDisplay, List<FunctionSeriesData> ? functionSeries, List<LegendEntry> ? legend}) → LineChartData - Returns a copy of this data with the given fields replaced. Fields not specified retain their current value. Nullable fields cannot be cleared via copyWith — construct a new LineChartData directly when that's needed.
-
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.
override