-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Using a shared webgl context across graph divs (e.g for dashboard apps)? #2333
Comments
That shouldn't happen since |
Ok. Are you embedding plots from our cloud service on plot.ly? |
no, we are not using the cloud service we directly create the plots - we are using Angular 4 ie. Plotly.newPlot(this.element.nativeElement, this.data, this.plotlyLayout, this.plotlyConfiguration ); our layout for a chart looks like this:
|
... and what does |
1.33.1 |
Oh. Sorry I misread. You have 10 different If the former is correct, I think I know what's happening: Before Now starting in We aren't planning on extended WebGL-context sharing across multiple graphs in the near future unfortunately, but it's something we should think about. So, thanks very much for posting. In the meantime, I suggest converting your 10 graph |
Thank you - we have a dashboard like page with many different charts that
aren't really subplots
We need scattergl since we load a large quantity of points.
|
We should give https://github.com/regl-project/multi-regl a try. It might be just what we need here. |
I saw the last reply from @etpinard on #2614. It sounds like they've reduced the number of contexts used by each plot from 3 to 2. Which theoretically should allow 7 GL plots at once. In practice, this doesn't work very well though. We're constantly updating the plot data and layout, and after trying out the various Plotly methods ( Apparently, a So, one thing that could help is to provide a way to re-create a chart (like a Obviously, it would also help if each plot only used one context (instead of two). If each plot used one context, and we could re-create plots while continuing to use the same contexts, that would allow for up to 16 GL plots. Now, an ever better option would be to share contexts across all of the plots. To help with performance, the best option would be a way to tell Plotly to pre-allocate N contexts to a "Plotly GL context pool", and use them as needed across all plots on the page. So we could set this to 12, or 14 or whatever we wanted to. We have chart sets that include a Cesium plot, so we need to allow for some contexts to be used outside of Plotly. On a loosely related note, I have an open issue with Chrome to make the GL context limit configurable (https://bugs.chromium.org/p/chromium/issues/detail?id=771792#c10). The limit of 16 was chosen arbitrarily, and anyone with a powerful GPU should easily be able to handle more than 16. |
That shouldn't happen. Calling Would you mind sharing a reproducible example? |
The problems we had with
At one point I tried combining several of these (e.g.: I have not had a chance to look at |
Ha I see. You might want to try our newest API method |
Right, I mentioned |
Yes 🎉 |
OK, that may be something to look at. It would help with the asynchronous release of the contexts causing context limit errors. However, the underlying issue of allowing for more than 6 or 7 GL plots at once is still a challenge. Some sort of context sharing across all of the GL plots would be a great option. I've also looked at subplots to handle this, but the lack of a modebar for each subplot is one issue (e.g. can't autoscale only one subplot), and determining a "dynamic" full-screen layout for the subplots is challenging, when the number of plots shown varies, and when the user can add and remove plots at will. Right now we're using divs with column-based flex layout for the chart sets, so they effectively use all the available browser width and height. |
Another workaround is to virtual scrolling so that only 6 charts are rendered at one time. |
Is there a scatter renderer that uses 2d instead of webgl? Thanks. |
I'm using react-plotly.js and having the same issue, my case is a dashboard page that loads ~20 different plots with too many points. the page can handle 11 of them but after adding 12th one it starts showing the warning and some old plot randomly will be broken. The react component using the
|
in case someone finds this helpful, i'll plug https://github.com/leeoniya/uPlot, which does not use GL, is lightweight and can handle hundreds of charts with millions of datapoints without issue. |
This issue has been tagged with A community PR for this feature would certainly be welcome, but our experience is deeper features like this are difficult to complete without the Plotly maintainers leading the effort. Sponsorship range: $25k-$30k What Sponsorship includes:
Please include the link to this issue when contacting us to discuss. |
@jackparmer I just reached out to Rob to discuss what would be involved. We'd definitely like to have this fixed. |
@selimonat not if they all use WebGL trace types and they're all rendered on the page simultaneously. You can use as many SVG plots as you want, but if you have lots of WebGL plots you'll need to either combine them as subplots or take some of them off the page - for example put them in separate |
I've added a question about this on Stack Overflow, but please note that this is also problem when sharing webgl across subplots, not just when sharing webgl context across divs (as suggested in issue title). |
Thanks @CnrLwlss - I had forgotten about this part, but I think (correct me if I'm wrong @archmoj) it's just the 3D plots, which use the old stack.gl system rather than regl, that still create one WebGL context per subplot. If you do the same test using @archmoj I guess as we're considering a full solution to this issue we'll have to figure out either porting 3D into regl or making the 3D subplots reuse regl's context before we can consider it done. |
Even I am getting the webgl issue when using scattergl with 2 subplots on plotly js |
Just noting that I am hitting this in the use case of using plotly express in a jupyter notebook where I generate lots of plots. |
To resolve the problem, a new plotly version and <script src="https://unpkg.com/virtual-webgl@1.0.6/src/virtual-webgl.js"></script> needs to be included in the page. With Jupyter a cell from IPython.display import display, HTML
js = "<script src=\"https://unpkg.com/virtual-webgl@1.0.6/src/virtual-webgl.js\"></script>"
display(HTML(js)) does the trick. |
We are adding 10+ scattergl charts to a page, but running into issues where we run out of webgl contexts. It appears that creating a new plot.ly chart uses it's own webgl context.
Is there a way to create a webgl context and use it for all the charts, or is there a another way to have many charts on the page without having this issue ?
Thanks
The text was updated successfully, but these errors were encountered: