ChartController class

ChangeNotifier-based controller for programmatic chart updates.

Manages chart data and annotations, providing methods for real-time updates with automatic listener notification.

Example:

final controller = ChartController();

// Add data points
controller.addPoint('temperature', ChartDataPoint(x: 0, y: 20.0));
controller.addPoint('temperature', ChartDataPoint(x: 1, y: 22.5));

// Add annotations
controller.addAnnotation(
  TextAnnotation(
    position: Offset(100, 50),
    label: 'High temp alert',
  ),
);

// Clean up
controller.dispose();
Inheritance

Constructors

ChartController()

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
revision → int
Monotonically increasing revision of data and annotation mutations.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addAnnotation(ChartAnnotation annotation) → String
Adds a chart-level annotation.
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addPoint(String seriesId, ChartDataPoint point) → void
Adds a data point to the specified series.
clearAnnotations() → void
Clears all annotations from the chart.
clearSeries(String seriesId) → void
Clears all points from the specified series.
dispose() → void
Discards any resources used by the object.
override
findAnnotationsAt(Offset position) → List<ChartAnnotation>
Finds annotations near the specified position.
getAllAnnotations() → List<ChartAnnotation>
Returns a copy of all chart-level annotations as a list.
getAllSeries() → Map<String, List<ChartDataPoint>>
Returns a copy of all series data.
getAnnotation(String id) → ChartAnnotation?
Returns a chart-level annotation by ID, or null if not found.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeAnnotation(String id) → void
Removes an annotation by ID.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeOldestPoint(String seriesId) → void
Removes the oldest point from the specified series.
toString() → String
A string representation of this object.
inherited
updateAnnotation(String id, ChartAnnotation annotation) → void
Updates an existing chart-level annotation.

Operators

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