`onClick` event handler doesn't take into account a right-click for Pie Charts.
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodePen reproduction and trace Plotly's pie-chart click handling, comparing it with the behavior of line and bar charts. Done means a right-click on a pie slice triggers the plotly_click event consistently, with regression coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100