Skip to content

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

Closed
@nZo-sp

Description

@nZo-sp

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions