Is there a pie chart slice hover event in Highcharts?

I just started using Highcharts and I need to capture an event when the user hovers over a slice of the pie and also to get contextual information about that slice. Is there an event for that? I haven’t been able to find one in the documentation.

Answer

plotOptions.series allows events.mouseOver and events.mouseOut handlers to be added, a la:

$('#container').highcharts({
    ...
    plotOptions: {
        series: {
            point: {
                events: {
                    mouseOver: function () {
                        $reporting.html('x: ' + this.x + ', y: ' + this.y);
                    }
                }
            },
            events: {
                mouseOut: function () {
                    $reporting.empty();
                }
            }
        }
    },
    ...
});

Demo

Leave a Reply

Your email address will not be published. Required fields are marked *