Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plotOptions.series.point.events returns null point data when using a drilldown

I'm binding a click event on every series point in order to get the data associated with the point.

plotOptions: {
        series: {
            point: {
                events: {
                    click: function () {
                       console.log("that > ", this);
                    }
                }
            }
        }
    }

If I have a chart with no drilldown It works fine ( fiddle ).

However, if I define a drilldown ( fiddle ) i can only get the point data for the inner series. The point data is null for the slice i just clicked to drilldown.

this > c {series: null, name: null, y: null, drilldown: null, options: null…}

Is this a bug or am i missing something ?

like image 953
mfreitas Avatar asked Sep 21 '26 17:09

mfreitas


2 Answers

It is a bug.

Reported to our developers here.

like image 166
Sebastian Bochan Avatar answered Sep 23 '26 08:09

Sebastian Bochan


This happens because your click handler gets executed when the clicked element has already disappeared. Looks like a bug to me.

A quick fix would be to modify highcharts js/modules/drilldown.src.js around line 513 to look like this:

// Add the click event to the point label
H.addEvent(point, 'click', function () {
    setTimeout(function() {
        point.doDrilldown();
    }, 100);
});

Here's a modified fiddle.

like image 28
Cajus Pollmeier Avatar answered Sep 23 '26 06:09

Cajus Pollmeier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!