Plot resize doesn't work for CSS grid layout
The Plot component doesn't resize properly when using CSS grid for page layout. It will grow, but it never shrinks.
Example: https://codepen.io/swiperii/pen/qMgdwO?editors=0010
@antoinerg can you take a look at this one please?
This one should be fixed when plotly.js v1.42.0 is released! 🎉
Due to a recent commit https://github.com/plotly/plotly.js/pull/3090/commits/af4a2cefe10de4eb855f31c9503cb87e68458a90, useResizeHandler will have to set plotly.js config to responsive: true in order to fix the current issue. By doing so, plotly.js would start handling responsiveness. Hopefully this transition goes smoothly. @nicolaskruchten Do you see any potential problems with such a change?
I'm still having the same issue, using [email protected] and [email protected]
@findoslice If you specify responsive: true in the config option it should work properly: https://codepen.io/antoinerg/pen/wLOygM?editors=0010
@findoslice Can you confirm the above fixes your issue?
@antoinerg Unfortunately I no longer work for the company where this issue came up, however from memory it didn't at the time
@antoinerg I encountered the same issue and I also confirmed that your suggestion fixed my issue. Thanks a lot!
@findoslice If you specify
responsive: truein the config option it should work properly: https://codepen.io/antoinerg/pen/wLOygM?editors=0010
@antoinerg I also had the same issue using CSS Grid and I can confirm your suggestion works. I'm using React in an Electron app and my code looks like this:
<Plot useResizeHandler style={{ height: '100%', width: '100%' }} data={[ { x: signalTime, y: signalData, mode: 'lines', marker: { color: 'red' }, }, ]} layout={{ autosize: true, margin: { t: 50, l: 45, r: 45, b: 40 }, title: 'A Fancy Plot', xaxis: { title: 'Time in seconds' }, yaxis: { title: 'X Track Error' }, }} config={{ scrollZoom: true, responsive: true }} />