attachTo method

  1. @override
void attachTo(
  1. BaseChart<D> chart
)
override

Injects the behavior into a chart.

Implementation

@override
void attachTo(BaseChart<D> chart) {
  if (chart is! CartesianChart<D>) {
    throw ArgumentError(
      'InitialHintBehavior can only be attached to a CartesianChart<D>',
    );
  }

  _chart = chart;

  chart
    ..addGestureListener(_listener)
    ..addLifecycleListener(_lifecycleListener);
}