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");
});

The names of events are case-insensitive.

Detaching event listeners

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

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

Calling events

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

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.

Back to top