Interactions

To start listening for interactions on any chart, provide the appropriate [SeriesType]InteractionEvents class to the interactionEvents parameter of any Series.

For example, BarSeries will accept interactionEvents of type BarInteractionEvents.

Look into interaction guides of individual charts to learn more about chart-specific interaction details.

Interaction Events

Every InteractionEvents class supports these types of interaction callbacks.

Event
Description

onTapDown

Called when the pointer that will trigger a tap gesture comes in contact with the screen.

onTapUp

Called when the pointer that will trigger a tap gesture stops making contact with the screen.

onTap

Call after the tap gesture is completed, i.e. right after onTapUp.

onDoubleTap

Called when a double tap gesture is detected.

onDragStart

Called when a pointer comes in contact with the screen and starts to move.

onDrag

Called when the pointer location is updated for the pointer that started the drag gesture.

onDragEnd

Called when the pointer that started the drag gesture stops moving.

onRawInteraction

Called for every type of interaction event.

Enabling and Disabling interactions

Along with the interaction callbacks, every InteractionEvents class has a isEnabled boolean to enable and disable interactions.

BarSeries(
    ...
    interactionEvents: BarInteractionEvents(
          isEnabled: true,
          ...
    ),
);

Interaction Result

Each InteractionEvent callback will receive a Series specific interaction result as an argument.

Look into interaction guides of individual charts to learn more about chart-specific interaction details provided to in the interaction result.

Each interaction result has

Property
Description

localPosition

The offset of the interaction relative to the chart

interactionType

RelevantTouchInteractionType for the result.

TouchInteractionType

TouchInteractionType is an enum with the following values

  • tap

  • tapUp

  • tapDown

  • doubleTap

  • dragStart

  • drag

  • dragEnd

Last updated