megaplot icon indicating copy to clipboard operation
megaplot copied to clipboard

Better handling of invisible plots when container width or height are 0

Open RyanMullins opened this issue 3 years ago • 1 comments

On LIT, we're using MegaPlot to replace the Scalars module. I noticed that the div.scatterplot-container into which I render a MegaPlot scene in the firstUpdated() lifecycle hook has a width of 0 (width: 100%; in CSS, but LIT's widget rendering code doesn't set the parent's width until later). This resulted in a <canvas> being added to the screen, but all of the content was effectively invisible.

Could MegaPlot:

  1. throw some sort of error when the width or height of the container into which it's appending the <canvas> are 0?
  2. Wait until the width and height of the container are non-zero (e.g., using a ResizeObserver) before rending the scene?

RyanMullins avatar May 04 '22 15:05 RyanMullins

Is this still an issue? I believe the behavior around zero-sized containers has been improved, but I don't recall if it solved exactly this case.

jimbojw avatar Mar 14 '23 20:03 jimbojw