diff --git a/src/plots/cartesian/graph_interact.js b/src/plots/cartesian/graph_interact.js index 9994260899c..8c9c7f9a3b9 100644 --- a/src/plots/cartesian/graph_interact.js +++ b/src/plots/cartesian/graph_interact.js @@ -1276,7 +1276,7 @@ fx.click = function(gd,evt){ if(gd._hoverdata && evt && evt.target) { gd.emit('plotly_click', {points: gd._hoverdata}); // why do we get a double event without this??? - evt.stopImmediatePropagation(); + if(evt.stopImmediatePropagation) evt.stopImmediatePropagation(); } }; diff --git a/src/traces/pie/index.js b/src/traces/pie/index.js index 9958c3055d5..25f1a69601f 100644 --- a/src/traces/pie/index.js +++ b/src/traces/pie/index.js @@ -373,6 +373,12 @@ pie.plot = function(gd, cdpie) { } } + function handleClick (evt) { + gd._hoverdata = [pt]; + gd._hoverdata.trace = cd.trace; + Plotly.Fx.click(gd, { target: true }); + } + slicePath.enter().append('path') .classed('surface', true) .style({'pointer-events': 'all'}); @@ -381,7 +387,8 @@ pie.plot = function(gd, cdpie) { sliceTop .on('mouseover', handleMouseOver) - .on('mouseout', handleMouseOut); + .on('mouseout', handleMouseOut) + .on('click', handleClick); if(trace.pull) { var pull = +(Array.isArray(trace.pull) ? trace.pull[pt.i] : trace.pull) || 0;