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('Slider can only be attached to a cartesian chart.');
  }

  _chart = chart;

  // Only vertical rendering is supported by this behavior.
  assert(chart.vertical);

  _view = _SliderLayoutView<D>(
      layoutPaintOrder: layoutPaintOrder, handleRenderer: _handleRenderer);

  chart.addView(_view);
  chart.addGestureListener(_gestureListener);
  chart.addLifecycleListener(_lifecycleListener);
}