plotly / plotly/react-plotly.js

how to use modebar buttons handlers

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

還沒有人認領這個 Issue。

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

描述

I am using "react-plotly.js": "^2.2.0" ,

  1. I am using react Image component
  2. on click of image i am calling ResetOnly(event) {
    var plotDiv = document.getElementsByClassName('plot-chart-class1');
    //var button = event.currentTarget;
    // button.setAttribute('data-attr', 'zoom');
    // button.setAttribute('data-val', 'reset');
    ModeBarButtons.zoomIn2d.click(plotDiv[0], event);
    }
  3. i have imported import ModeBarButtons from 'plotly.js/src/components/modebar/buttons.js';
  4. I am getting this error
    registry.js:221 Uncaught TypeError: Cannot read property 'apply' of undefined
    at Object.exports.call (registry.js:221)
    at Object.handleCartesian [as click] (buttons.js:264)
    at PlotlyChart.ResetOnly (PlotlyChart.jsx:342)
    at HTMLUnknownElement.boundFunc (ReactErrorUtils.js:63)
    at Object.ReactErrorUtils.invokeGuardedCallback (ReactErrorUtils.js:69)
    at executeDispatch (EventPluginUtils.js:83)
    at Object.executeDispatchesInOrder (EventPluginUtils.js:106)
    at executeDispatchesAndRelease (EventPluginHub.js:41)
    at executeDispatchesAndReleaseTopLevel (EventPluginHub.js:52)
    at Array.forEach ()
  5. In registry.js file, in below function exports.apiMethodRegistry[name] is undefined
    exports.call = function() {
    var name = arguments[0];
    var args = [].slice.call(arguments, 1);
    return exports.apiMethodRegistry[name].apply(null, args);
    };
    can someone help me to resolve this issue

貢獻指南

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

從這裡開始

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

研究方向

首先,使用所述的 react-plotly.js 設定,在 PlotlyChart.jsx 中重現 modebar 按鈕點擊。閱讀 plotly.js/src/components/modebar/buttons.js 和 registry.js 中失敗呼叫附近的程式碼,然後確定被參照的 API 方法為何是 undefined;完成的標準是 handler 在沒有 registry 錯誤的情況下執行。

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

評估

技術堆疊
javascript, react
領域
data-visualization, frontend
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

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

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