plotly / plotly/react-plotly.js
onLegendClick gives wrong state
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 138
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 4
Description
Hi,
I've some wired problems when trying to work with the data from onLegendClick.
First example: The two data sources (Beningn, Others) don't have the same properties as the visible is missing in Benign.

Only if the Benign property got clicked once the visible property get's added.
Second example: When I click the legend I always get the data from the second last render. Meaning if I've just clicked on the legend I'll get the data from the second last render instead of the actual current render data.
Thanks for the help!
Contributor guide
No contributing guide indexed for this repository
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
No source files or tests are named. Start by reproducing the issue with two data sources and an onLegendClick handler, then trace how callback data is produced across renders. Done means both sources have consistent visible state and the callback exposes the current render's data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100