Skip to main content

Event handling

Attaching event listeners

You can attach event listeners with the chart.events.on() method:

chart.events.on("resize", function({width:500, height:500}){
console.log("The size of the chart has changed");
});

Related sample: Chart. Events

Detaching event listeners

To detach events, use the chart.events.detach() method:

chart.events.on("resize", function({width:500, height:500}){
console.log("The size of the chart has changed");
});

chart.events.detach("resize");

Calling events

To call events, use the chart.events.fire() method:

chart.events.fire("name",args);
// where args is an array of arguments

The list of events

The full list of events is available in the related API section.