plotly / plotly/plotly.js

[FEATURE]: Add `plotly_heatmapclick` event (similar to `plotly_treemapclick` / `plotly_sunburstclick`)

未关闭
#7,685 3 条评论 1 个 reaction 已指派 1 人 在 GitHub 查看

@nojaf 已经在做这个了。

开始于 2026年1月14日。

feature
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

Description

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.

graphDiv.on('plotly_heatmapclick', (data) => {
  // data.points[0] contains { x, y, z, pointIndex, curveNumber, ... }
});
Why should this feature be added?

We're building reactive heatmap charts in marimo where users can:

  1. Drag to select a range of cells → works via plotly_selected
  2. 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).

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。