Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting a 3D graph with config option staticPlot turned on results in blank graph #457

Open
etpinard opened this issue Apr 21, 2016 · 5 comments
Labels
bug something broken P3 backlog

Comments

@etpinard
Copy link
Contributor

http://codepen.io/etpinard/pen/QNBWoK

should display an image and the graph div.

@etpinard etpinard added the bug something broken label Apr 21, 2016
@etpinard
Copy link
Contributor Author

Post #1939, I'm thinking we should drop the staticPlot config option and make users call:

var img = document.createElement('img')

Plotly
  .toImage({data: data, layout: layout})
  .then(imgData => img.src = imgData)

to generate static images. No need to support staticPlot: true and toImage.

@McPonolith
Copy link

McPonolith commented Sep 9, 2022

So that staticPlot option is handy for a few reason. We are currently displaying many graphs on the one page (in react), we are unable to call toImage, as by the time we get around to it the context has already been lost, or the plot has not been rendered.

We ideally want to start with a static plot, however toImage requires creating a non static-plot first, which uses more webgl contexts . I also believe staticPlot correctly resizes aswell.

@alexcjohnson
Copy link
Collaborator

Right, staticPlot has other useful effects, like omitting most of the invisible elements used only to capture interactions, and changing some of the antialiasing settings for better print behavior. So I definitely think it deserves to stay.

Seems like what this requires is when staticPlot is enabled we wait until the webgl rendering is complete, then pull the images out of its canvases and into image elements, and finally dispose of the webgl contexts and canvases entirely.

@McPonolith if you're creating many graphs simultaneously this still may cause problems of too many contexts, and us dropping some. I guess in principle we could stash some global state saying "we're rendering a webgl plot as static" and have any others wait until previous ones are done and have released their contexts before they even try to render. Still not 100% clear that this would work, as in my experience browsers don't always handle these resources on the schedule we want them to!

@harahu
Copy link

harahu commented Mar 15, 2023

Was just bit by this issue. Hoping to see it worked on.

@blokhin
Copy link

blokhin commented Mar 26, 2024

I confirm staticPlot: true works as expected on 3D graphs on up to v1.37.1.

@gvwilson gvwilson self-assigned this Jun 5, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added the P3 backlog label Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

No branches or pull requests

6 participants