Skip to content

how to use modebar buttons handlers  #100

Open
@rupalikabra

Description

@rupalikabra

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions