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

Redraw errors after Plotly.update in a scattergl with subplots #2791

Closed
nZo-sp opened this issue Jul 9, 2018 · 1 comment
Closed

Redraw errors after Plotly.update in a scattergl with subplots #2791

nZo-sp opened this issue Jul 9, 2018 · 1 comment

Comments

@nZo-sp
Copy link

nZo-sp commented Jul 9, 2018

https://codepen.io/anon/pen/wxwpgm

In this pen after an amount of time a plotly.update is executed and the visibility for trace 2 is set to false.
The update is executed without clear the gl context.

This issue seems realted to a check inside plot_api.js at line 212:

function drawFramework() {
...
...
    if(!fullLayout._glcanvas && fullLayout._has('gl')) {
            fullLayout._glcanvas = fullLayout._glcontainer.selectAll('.gl-canvas').data([{

the data for each gl-canvas is recreated in any case even if there is already a data with a regl reference.
This leads to the clearGlCanvases that does nothing if regl is not defined.

module.exports = function clearGlCanvases(gd) {
    var fullLayout = gd._fullLayout;

    if(fullLayout._glcanvas && fullLayout._glcanvas.size()) {
        fullLayout._glcanvas.each(function(d) {
            if(d.regl) d.regl.clear({color: true, depth: true});
        });
    }
};

I hope this helps.

@etpinard
Copy link
Contributor

etpinard commented Jul 9, 2018

A reference must get lost when calling Plotly.update with the same layout object as the first newPlot.

Calling Plotly.update('myDiv', {visible: [false]}, {}, [0]) works just fine: https://codepen.io/etpinard/pen/QBLVBz?editors=1010 or its react variant

  data[0].visible = false;
  Plotly.react('myDiv', data, layout); 

as in https://codepen.io/etpinard/pen/GBKXYQ?editors=1010 works fine too.

Thanks for the report.

etpinard added a commit that referenced this issue Jul 9, 2018
- Some edits may call makePlotFramework, we can't clear the ref to
  glcanvas there as we need to properly clear the canvases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants