[BUG]: Some event payload types don't match what's actually emitted

未關閉
#8,147 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@darshpatel1052 已經在處理了。

開始於 2026年11月3日。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
68/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, typescript

研究方向

Start with src/types/core/events.d.ts and compare the event interfaces with the emitted payloads listed in the issue, including the parcoords hover and unhover events. Check related tests or event definitions for these cases; done means the types represent the listed payload shapes and optional fields accurately.

由索引模型根據 Issue 內容生成。

描述

bug P2 plotly-internal size: 1
Description

Some event types in src/types/core/events.d.ts do not match the payload that plotly.js emits.

Steps to reproduce
  • Register gd.on('plotly_beforeplot', (event) => event.data) and call Plotly.newPlot. The code compiles, but event.data is undefined.
  • Register gd.on('plotly_selected', (event) => event.points) and clear a selection. The code compiles, but event is undefined.
  • Register gd.on('plotly_click', (event) => event.event.clientX) on a scatter3d plot. The code compiles, but event.event is undefined.
Notes
  • This is a follow-up to #8145
  • Required changes:
    • plotly_beforeplot: the payload is the tuple [data, layout, config], but BeforePlotEvent is an object.
    • plotly_selected: the payload is undefined when a selection is cleared, but the callback type does not allow it.
    • PlotMouseEvent.event: gl3d traces emit no event, but the field is required.
    • PlotHoverEvent.xvals and yvals: only cartesian traces set them, but both fields are required.
    • LegendClickEvent.node: the value is an SVG element, but the type is PlotlyHTMLElement.
    • Missing optional fields: xaxes, yaxes, xvals and yvals on click events, selections on plotly_selected, group and label on legend clicks, and subplotId on annotation clicks.
    • parcoords emits plotly_hover and plotly_unhover with {x, y, clientX, clientY, dataIndex, curveNumber}, with no points or event.
  • Fixing plotly_beforeplot and plotly_selected is a changes existing types and could break existing code for some users. This wouldn't be a breaking change because it falls under a bug fix.
主要語言
JavaScript
星號
18.4k
分支
2.1k
平均合併
2 天 16 小時
30 天內合併 PR
11

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

plotly/plotly.js 的其他 Issue

查看 plotly/plotly.js 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。