[BUG] `dcc.Graph` `figure` prop may include Plotly.js `_inputArray` for typed arrays
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
When a dcc.Graph figure data contains typed arrays (for example int8, float32, etc.), the figure can include a Plotly.js internal field _inputArray
In the example below, the _inputArray is included after user interaction but not when the figure is first rendered.
_inputArray duplicates bdata and also includes decoded data, increasing callback payload size and overhead for large datasets.
Possible fixs:
- strip
_inputArrayin dcc.Graph before updating thefigureprop. But that might be considered a breaking change since some people are now using_inputArrayin callbacks. - Have an option to not encode np arrays when using dash. This will also fix the issue of
customdatanot being available isclickData,hoverDataif they are np arrays
Other related issues:
- Need a way to covert the typed arrays so the data is usable in a dash callback: https://github.com/plotly/dash/issues/3307
When app first renders (no _inputArray):
After hover (with _inputArray):
Sample App:
from dash import Dash, html, dcc, Input, Output
import numpy as np
import plotly.express as px
import json
app = Dash()
data = np.random.normal(0, 1, 250)
fig = px.histogram(data, nbins=20)
app.layout = html.Div([
dcc.Graph(id="graph", figure=fig),
html.Pre(id="fig-data")
])
@app.callback(
Output("fig-data", "children"),
Input("graph", "figure"),
Input("graph", "hoverData"),
)
def debug(figure, hoverData):
return json.dumps(figure["data"][0]["x"], indent=4)
if __name__ == "__main__":
app.run(debug=True)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まずサンプルの Dash アプリを実行し、ホバー前後の dcc.Graph の figure を調べます。typed-array データと _inputArray フィールドに重点を置いてください。dcc.Graph と Plotly.js 周辺の figure および callback の payload 処理を追跡します。_inputArray に対して選択した動作が一貫して実装され、typed-array における customdata の動作が考慮され、payload サイズが検証されていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, numpy, python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 50/100