Add heatmap click workaround - #7869
Closed
nojaf wants to merge 1 commit into
Closed
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
Superseded by #8255 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
This PR serves as a starting point to discuss a problem I noticed with click on a heatmap.
Sample notebook:
🔍 Description of Changes
I have a workaround in Marimo (in this PR), to fix this.
But I can't pinpoint the problem outside of Marimo in either Plotly or react-plotly.
Heatmap Click Event Investigation
Heatmap Click Event Investigation
Summary
Investigation into GitHub issue #7685 and PR #7686 regarding heatmap click events not working properly when
dragmode: 'select'is enabled in marimo notebooks.Conclusion
The bug is NOT in plotly.js or react-plotly.js. It is specific to marimo's build/bundling environment.
Test Results
Evidence
CodePen with exact same versions as marimo (
plotly.js 2.35.3+react-plotly.js 2.6.0):Marimo with same versions:
Root Cause
The issue is in marimo's build/bundling environment, likely one of:
Workaround Implemented in Marimo
Since
plotly_selectedfires withundefineddata on single clicks andgd._hoverdatais still populated at that moment, we extract heatmap click data from there:CodePen for Verification
This CodePen proves plotly.js + react-plotly.js work correctly:
Files Changed in Marimo
frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx- Added workaround inonInitializedto capture heatmap clicks viaplotly_selectedeventNext Steps for Marimo
The workaround is functional, but the root cause in marimo's build should be investigated:
LazyPlot📋 Checklist
@mscolnick do you have any thoughts on this?