attachTo method

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

Injects the behavior into a chart.

Implementation

@override
void attachTo(BaseChart<D> chart) {
  _chart = chart;
  chart.addGestureListener(_listener);

  // TODO: Update this dynamically based on tappable location.
  switch (eventTrigger) {
    case SelectionTrigger.tap:
    case SelectionTrigger.tapAndDrag:
    case SelectionTrigger.pressHold:
    case SelectionTrigger.longPressHold:
      chart.registerTappable(this);
      break;
    case SelectionTrigger.hover:
    default:
      chart.unregisterTappable(this);
      break;
  }
}