BravenChartController class
Programmatic control over series, point linking, and Y-axis slot state.
Attach to BravenChartPlus.controller to drive series selection and axis swaps from outside the chart widget.
The controller is optional — charts without one still respond to legend taps and data-point taps internally. Add a controller when you need to read slot state, link another surface by ChartPointRef, capture an effective document, or trigger selection externally.
Example:
final _controller = BravenChartController();
@override
void dispose() {
_controller.dispose();
super.dispose();
}
// Somewhere outside the chart:
_controller.selectSeries('heat_strain');
print(_controller.visibleAxisIds);
- Inheritance
-
- Object
- ChangeNotifier
- BravenChartController
Constructors
Properties
- debugSelectionPointRefsMaterialized → bool
-
Whether the attached selection has allocated concrete point identities.
no setter
-
effectiveDocumentRevision
→ ValueListenable<
ChartDocumentRevision?> -
Opaque revision of the effective document source attached to this chart.
no setter
-
focusedPointRefs
→ Set<
ChartPointRef> -
Transient point focus currently rendered by the attached chart.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
Series IDs currently excluded from rendering by visibility state.
no setter
-
overflowAxisIds
→ List<
String> -
Axis IDs currently in overflow (voted out of visible slots).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selectedPointRefs
→ Set<
ChartPointRef> -
Durable point selection currently rendered by the attached chart.
no setter
- selectedSeriesId → String?
-
Currently selected series ID, or null if nothing is selected.
no setter
-
selectedSeriesIds
→ Set<
String> -
Series currently included in durable semantic selection.
no setter
- selectionBrushState → ChartSelectionBrushState?
-
Current persistent interval brush, or null when no brush exists.
no setter
- selectionExpression → ChartSelectionExpression
-
Compact renderer-neutral intent for the current durable selection.
no setter
- selectionResult → ChartSelectionResult
-
Latest stable identities, extents, and statistics for point selection.
no setter
- selectionSnapshot → ChartSelectionSnapshot?
-
Current revision-bound selection, resolved lazily on demand.
no setter
-
visibleAxisIds
→ List<
String> -
Axis IDs currently occupying visible slots, in slot order.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
attach(
{Object? attachment, required void onSelect(String), required ChartSeriesCommandHandler onSelectSeriesIds, required void onDeselect(String), required void onClear(), void onSetSeriesVisibility(String, bool)?, ChartDocumentExtractionHandler? onExtractDocument, ChartDocumentExtractionHandler? onExtractSourceDocument, void onRestoreViewState(ChartViewState)?, ChartPreviewCaptureHandler? onCapturePreview, ChartPointCommandHandler? onFocusPoints, ChartPointCommandHandler? onSelectPoints, ChartSelectionExpressionCommandHandler? onSelectExpression, ChartSelectionCommandHandler? onInvertSelection, ChartSelectionZoomCommandHandler? onZoomToSelection, ChartViewportZoomCommandHandler? onZoomViewport, ChartViewportPanCommandHandler? onPanViewport, ChartViewportFitCommandHandler? onFitData, ChartBooleanCommandHandler? onSelectAllData, ChartBooleanCommandHandler? onClearAllSelection, ChartBooleanCommandHandler? onReturnToLive, ChartSelectionBrushSetCommandHandler? onSetSelectionBrush, ChartSelectionBrushBoxSetCommandHandler? onSetSelectionBrushBox, ChartSelectionBrushVisibilityCommandHandler? onSetSelectionBrushVisibility, ChartSelectionCommandHandler? onClearSelectionBrush, void onClearPointFocus()?, void onClearPointSelection()?, void onReplayRadialEntrance()?, void onReplaySeriesEntrance()?, ChartDocumentRevision? effectiveDocumentRevision}) → void - Attaches this controller to a chart state. Called by the state.
-
capturePreview(
[ChartPreviewOptions options = const ChartPreviewOptions()]) → Future< ChartArtifactResult< ChartPreview> > - Captures a revision-bound PNG preview of the mounted chart.
-
clearAllSelection(
) → bool - Clears durable point, series, expression, and brush selection together.
-
clearPointFocus(
) → void - Clears transient point focus.
-
clearPointSelection(
) → void - Clears durable point selection.
-
clearSelection(
) → void - Deselects all series. Reverts slot order on both sides if mode is AxisSwapMode.revert.
-
clearSelectionBrush(
) → ChartArtifactResult< void> - Clears the persistent brush and its semantic selection.
-
deselectSeries(
String seriesId) → void -
Deselects
seriesId. If BravenChartPlus.axisSwapMode is AxisSwapMode.revert, restores the original slot order for that side. -
detach(
[Object? attachment]) → void - Detaches from the chart state. Called in dispose.
-
dispose(
) → void -
Discards any resources used by the object.
override
-
extractArtifact(
[ChartArtifactExtractOptions options = const ChartArtifactExtractOptions()]) → Future< ChartArtifactResult< ChartArtifact> > - Extracts one portable artifact and optionally a hash-matched preview.
-
extractDocument(
[ChartDocumentExtractOptions options = const ChartDocumentExtractOptions()]) → ChartArtifactResult< ChartDocumentSnapshot> - Captures the chart's effective document and optional current view state.
-
extractSourceDocument(
[ChartDocumentExtractOptions options = const ChartDocumentExtractOptions()]) → ChartArtifactResult< ChartDocumentSnapshot> - Captures the chart document for readable Dart source generation.
-
fitData(
) → bool - Restores the mounted Cartesian chart's complete data viewport.
-
focusPoint(
ChartPointRef point, {required ChartDocumentRevision revision, bool reveal = false}) → ChartArtifactResult< void> -
Focuses one point from a document captured at
revision. -
focusPoints(
Iterable< ChartPointRef> points, {required ChartDocumentRevision revision, bool reveal = false}) → ChartArtifactResult<void> - Focuses every point represented by one row or host interaction.
-
hideSelectionBrush(
) → ChartArtifactResult< void> - Hides an existing persistent brush while retaining its selection.
-
invertSelection(
) → ChartArtifactResult< void> - Selects every valid source datum not currently selected.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
panViewport(
{required double horizontalPixels, required double verticalPixels}) → bool - Translates the mounted Cartesian viewport in logical pixels.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
replayRadialEntrance(
) → void - Replays the configured Pie, Donut, Radial Bar, Polar Column, or Gauge entrance animation.
-
replaySeriesEntrance(
) → void - Replays the configured entrance animation for Line, Area, Pie, or Donut.
-
restoreViewState(
ChartViewState viewState) → void - Restores durable visibility, selection, viewport, and axis-slot state.
-
returnToLive(
) → bool - Returns a managed streaming viewport to follow-latest mode.
-
selectAllData(
) → bool - Selects all chart data when the mounted renderer can do so safely.
-
selectExpression(
ChartSelectionExpression expression, {required ChartDocumentRevision revision, bool reveal = false}) → ChartArtifactResult< void> -
Replaces durable selection with renderer-neutral
expressionintent. -
selectPoint(
ChartPointRef point, {required ChartDocumentRevision revision, bool reveal = false, bool additive = false}) → ChartArtifactResult< void> -
Selects one durable point from a document captured at
revision. -
selectPoints(
Iterable< ChartPointRef> points, {required ChartDocumentRevision revision, bool reveal = false, bool additive = false}) → ChartArtifactResult<void> - Selects every point represented by one row or host interaction.
-
selectSeries(
String seriesId) → void -
Selects
seriesId. If its axis is in overflow, promotes it to a visible slot by demoting the last-declared visible axis on the same side. -
selectSeriesIds(
Iterable< String> seriesIds, {ChartSelectionOperation operation = ChartSelectionOperation.replace}) → void -
Applies
operationto every supplied series in one atomic command. -
setSelectionBrush(
{required double minimum, required double maximum, String? referenceSeriesId, bool visible = true}) → ChartArtifactResult< void> -
Sets the persistent interval brush to
minimumandmaximum. -
setSelectionBrushBox(
{required double minimumX, required double maximumX, required double minimumY, required double maximumY, String? referenceSeriesId, bool visible = true}) → ChartArtifactResult< void> - Sets a persistent box brush in the attached chart's X and Y domains.
-
setSeriesVisible(
String seriesId, bool visible) → void -
Shows or hides
seriesIdwhile retaining it in full-document exports. -
showSelectionBrush(
) → ChartArtifactResult< void> - Shows an existing persistent brush without changing its selection.
-
toggleSeriesVisibility(
String seriesId) → void -
Toggles
seriesIdusing the latest visibility mirrored from the chart. -
toString(
) → String -
A string representation of this object.
inherited
-
updateSlotState(
{required String? selectedSeriesId, required Set< String> selectedSeriesIds, required List<String> visibleAxisIds, required List<String> overflowAxisIds, }) → void - Updates mirrored slot state (called after every swap or selection change).
-
zoomToSelection(
{double paddingFraction = 0.08}) → ChartArtifactResult< void> - Fits the Cartesian viewport to the current durable selection.
-
zoomViewport(
double factor) → bool - Scales the mounted Cartesian viewport around its plot centre.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited