Skip to content

onClick event handler doesn't take into account a right-click for Pie Charts. #6633

Description

@dustinstender

Reproduction of bug - https://codepen.io/dstender/pen/LYXEGYZ

Simple code example:

var myPlot = document.getElementById('myDiv'),
    data = [{
  values: [19, 26, 55],
  labels: ['Residential', 'Non-Residential', 'Utility'],
  type: 'pie'
}],
    layout = {hovermode:'closest',
              title:'Click on Points'
     };

Plotly.newPlot('myDiv', data, layout);

myPlot.on('plotly_click', function(){
    alert('You clicked this Plotly chart!');
});

I discovered this issue while using the react-plotly.js library. I wanted to handle the left and right clicking of a slice of a pie chart in the same manner. However, I noticed that the onClick event doesn't catch a right click. This is not the case for other charts (Line, Bar, etc...).

It seems to me that this is related to plotly.js rather than react-plotly.js but of course I could be wrong. If this is a legit bug are there any workarounds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions