react-plotly.js icon indicating copy to clipboard operation
react-plotly.js copied to clipboard

onUpdate - reset the zoom in Nextjs (React)

Open tannath opened this issue 1 year ago • 2 comments

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);
};

tannath avatar Sep 01 '23 09:09 tannath

use Lodash should work

jarrisondev avatar Sep 14 '23 20:09 jarrisondev

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.

tannath avatar Sep 15 '23 05:09 tannath