plotly / plotly/react-plotly.js

Tooltip misaligned when using global data object, layout prop and onHover that manipulates state

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

還沒有人認領這個 Issue。

主要語言
JavaScript
星號
1.1k
分支
138
平均合併
3 天 2 小時
30 天內合併 PR
4

描述

The tooltip hover functionality gets messed up when the following conditions are met:

  • You got your own data object which isn't reinitialized every time the plot is rendered.
  • You have declared a custom onHover function
  • You update state to get the component to re-render
  • You have defined the layout property in the Plot component

This sandbox reproduces the error
https://codesandbox.io/s/qx5qr2m5x4

Hover one of the points in the plot. The tooltip will be shown briefly and afterwards the rest of the points will be misaligned towards the axes.

Versions used:
plotly.js 1.37.1
react-plotly.js 2.2.0

Tested on:
chrome
edge

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

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

研究方向

首先使用列出的 plotly.js 和 react-plotly.js 版本執行連結的 CodeSandbox,然後在自訂 onHover 更新 state 時將游標移到某個點上,以重現錯位問題。追蹤 Plot 元件對 global data object、layout prop 和 rerender 的處理。完成標準是 tooltip 正確顯示,且其餘的點在 state 更新後仍保持對齊。

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

評估

技術堆疊
javascript, react
領域
data-visualization, frontend
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

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

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