# Interactions

<figure><img src="https://672051664-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3JD7NLiao8wvvuzkAjT9%2Fuploads%2FSLAuohWijPkMC4vuxux7%2Fpie_chart_interactions.gif?alt=media&#x26;token=9e1c6595-332b-47c4-bfbe-c37ff3a3725d" alt=""><figcaption></figcaption></figure>

## Listening to interactions on Pie Chart

The `PieInteractionEvents` class provides callbacks for all interactions happening on `PieChart`.&#x20;

Look at the common [interactions](https://flutter.wednesday.is/charts/guides/interactions "mention") guide to know about all the common interaction features.

Here we will see `PieChart` specific interaction details.

To start listening for interactions, provide an instance of `PieInteractionEvents` to the `interactionEvents` parameter on `PieSeries`.&#x20;

```dart
PieChart(
    ...
    data: PieSeries(
        ...
        interactionEvents: PieInteractionEvents(
          isEnabled: true,
          onTap: (result) {
             ...
          },
          onDrag: (result) {
            // Update the data and call setState so that the chart 
            // will re-render based on new data.
            setState(() {
              _interactionIndex = result.sliceDataIndex;
            });
          }),
          ...
      )
  );
   
```

## Pie Interaction Result

In addition to common parts described in [interactions](https://flutter.wednesday.is/charts/guides/interactions "mention"), the `PieIntractionResult` has the details of the slice for which the interaction was triggered.

Every interaction callback for `PieInteractionEvents` will receive an instance of `PieInteractionResult`.

In addition to `localOffset` and `TouchInteractionType`, `PieInteractionResult` has

| Properties       | Description                                    |
| ---------------- | ---------------------------------------------- |
| `slice`          | The `SliceData` that matches this interaction. |
| `sliceDataIndex` | The index of `slice` in `PieSeries` data.      |
