You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Add plotly_heatmapclick event (similar to plotly_treemapclick / plotly_sunburstclick) #7685
When using dragmode: "select", heatmaps do not fire plotly_click events for single clicks. This makes it impossible to handle both cell selection (drag) and single cell clicks in the same chart.
Treemap and Sunburst charts have dedicated click events (plotly_treemapclick, plotly_sunburstclick) that fire regardless of dragmode, but heatmaps have no equivalent.
Current Behavior
// With dragmode: "select"graphDiv.on('plotly_click',(data)=>{// Never fires for heatmaps});graphDiv.on('plotly_selected',(data)=>{// Fires with undefined data on single clicks});
Requested Behavior
Add a plotly_heatmapclick event (similar to how plotly_treemapclick works) that fires when clicking on a heatmap cell, regardless of dragmode setting.
We're building reactive heatmap charts in marimo where users can:
Drag to select a range of cells → works via plotly_selected
Click a single cell to select it → does not work with dragmode: "select"
Currently, users must drag even for single-cell selections, which is unintuitive.
Notes
If this feature is something the team would accept, I'm happy to submit a PR implementing it. Any pointers on where to start in the codebase would be appreciated (e.g., how plotly_treemapclick is implemented).
Nice use case! This should probably still be the plotly_click event, so it applies to all traces on a cartesian subplot, not just heatmaps. It may be that we can just consider it a bug that plotly_click isn't firing in this situation, or maybe we need a mode that enables this.
streamlit recently introduced a fix for treemap and sunburst click events PR 13935 pending in release 1.55. It would be great to have heatmaps covered by this too, such that the behaviour emitted by heatmaps is akin to that of treemaps and sunbursts. My use-case involves building-out calendar heatmaps where a date is clickable and emits events. See this potential approach.
Activity
alexcjohnson commentedon Jan 13, 2026
Nice use case! This should probably still be the
plotly_clickevent, so it applies to all traces on a cartesian subplot, not just heatmaps. It may be that we can just consider it a bug thatplotly_clickisn't firing in this situation, or maybe we need a mode that enables this.nojaf commentedon Jan 13, 2026
Thanks @alexcjohnson , made a first attempt over at #7686
Let me know what you think.
Analect commentedon Feb 28, 2026
streamlit recently introduced a fix for treemap and sunburst click events PR 13935 pending in release 1.55. It would be great to have heatmaps covered by this too, such that the behaviour emitted by heatmaps is akin to that of treemaps and sunbursts. My use-case involves building-out calendar heatmaps where a date is clickable and emits events. See this potential approach.