Mouse interactivity within subplots for plotly.js

Hi everyone,

I have exactly the same query as the one below but I am using plotly.js in a react project and not Dash Python.

“Is there a way to interactively resize the elements inside subplots by dragging on the splitters separating them? (preferably client side)
In addition it would be nice to be able to reorder the subplots interactively by dragging them with the mouse. (preferably client side)”
Mouse interactivity within subplots (resize - reorder) - Dash Python - Plotly Community Forum

I tried to convert the solution but not being familiar with dash it leads to nothing.
Is this possible in react ? I mean yes react-dragula exists and allows you to make draggable div but does it work for subplot such as : Mouse interactivity within subplots (resize - reorder) - #9 by jinnyzor

Hello @Tolosmoc,

Welcome to the community!

Yes, you should be able to wrangle this to work.

All charts obviously use the plotly functions, you just need to figure out what events are going to trigger the events. Instead of returning the new layout in the callback, you should be able to return the new figure to the plotly chart.

This should be where you would make the same changes. The figure in this example is just the combination of layout, data and frames from the Plotly chart.

I’m sorry but I don’t get it… How to use this function ?

I have my plot (I mean my data/layout/config parameters) but i render it directly via a tag with ‘react-plotly.js’:

            x: /* array of integers */,
      		y: /* array of integers */,
      		xaxis: 'x1',
      		yaxis: 'y1',
      		type: 'scatter',
      		x: /* array of integers */,
      		y: /* array of integers */,
      		xaxis: 'x2',
      		yaxis: 'y2',
      		type: 'scatter',

        grid: {rows: 2, columns: 1, pattern: 'independent'}

        /* config */

I therefore suppose that the operation must be made between the creation of the plot and its rendering… or is my way of rendering the plot a problem ?

The Plotly charts all use the JS file, to update a component after rendering, you can use different functions: