plotly / react-plotly.js

A plotly.js React component from Plotly 📈
MIT License
1.01k stars 135 forks source link

onUpdate - reset the zoom in Nextjs (React) #328

Open tannath opened 1 year ago

tannath commented 1 year ago

When use onUpdate the big problem with read any X and Y of selection. After selection using useState - setTempXandY reset the zoom in, state. How to solve the the reseting the zoom in, after XXXX seconds?

onUpdate={(EvEnT) => tempUpDaTe(EvEnT)}

const tempUpDaTe= (EvEnT: any) => {
    clearTimeout(timeoutId);
    timeoutId = setTimeout(() => {
        setTempXandY(prevState => ({
            ...prevState,
            x: e.layout.xaxis.range[0],
            y: e.layout.yaxis.range[0]
        }));
    }, 5500);
};
jarrisondev commented 12 months ago

use Lodash should work

tannath commented 12 months ago

use Lodash should work

This wrapper library (react-plotly.js) is bad by design. For now better solution is just use plotly.js.

Jarrison, please provide a (working) code example.