Skip to main content

Grafana Events

Version

The Business Charts Panel supports the event bus since version 4.2.0.

The Business Charts 5.0.0 allows you to unsubscribe from events to avoid memory leaks by returning an extended result object.

Grafana uses an event bus to publish application events for notifying different parts of Grafana when the user interacts with the chart. Apache ECharts can react to these actions by subscribing to one or more events.

Predefined Events

A full list of events is available in our Grafana Crash Course.

Subscribe to events

To subscribe and unsubscribe from events, you can create an extended result object.

const subscription = eventBus.subscribe({ type: 'data-hover' }, () => {
console.log('React to Data Hover')
})

return {
version: 2,
config: { notMerge: true },
option: {},
unsubscribe: () => {
subscription.unsubscribe();
console.log('Unsubscribed');
}
}