| commit | author | age | ||
| 83c3f6 | 1 | # Events |
| SP | 2 | The following properties define how the chart interacts with events. |
| 3 | ||
| 4 | | Name | Type | Default | Description | |
| 5 | | ---- | ---- | ------- | ----------- | |
| 6 | | `events` | `String[]` | `["mousemove", "mouseout", "click", "touchstart", "touchmove", "touchend"]` | The `events` option defines the browser events that the chart should listen to for tooltips and hovering. [more...](#event-option) | |
| 7 | | `onHover` | `Function` | `null` | Called when any of the events fire. Called in the context of the chart and passed the event and an array of active elements (bars, points, etc). | |
| 8 | | `onClick` | `Function` | `null` | Called if the event is of type 'mouseup' or 'click'. Called in the context of the chart and passed the event and an array of active elements | |
| 9 | ||
| 10 | ## Event Option | |
| 11 | For example, to have the chart only respond to click events, you could do | |
| 12 | ```javascript | |
| 13 | var chart = new Chart(ctx, { | |
| 14 | type: 'line', | |
| 15 | data: data, | |
| 16 | options: { | |
| 17 | // This chart will not respond to mousemove, etc | |
| 18 | events: ['click'] | |
| 19 | } | |
| 20 | }); | |
| 21 | ``` | |