Skip to content

Scatter-3D redraw() causes a RENDER WARNING and doesn't update all the traces #1023

@FMiscia

Description

@FMiscia

I have a scatter-3d plot with a data array of two traces: the first one is used to plot the funciton i want to show, the second one contains the clicked element with a different color. In this way when I click a point the point changes its color. Now this works, but quite often, the redraw method doesn't work for the second trace and i get this warning:

[.Offscreen-For-WebGL-049BA980]RENDER WARNING: Render count or primcount is 0.

here it is the snippet

        this.$.plot3d.on('plotly_click', function(d){
            var point_number = d.points[0].pointNumber
            var id = parseFloat(d.points[0].data.incrementalID[point_number])
            var index = util.issetArrayElement(data[1].incrementalID,id)
            if(index == -1){          
                data[1].x.push(d.points[0].x)
                data[1].y.push(d.points[0].y)
                data[1].z.push(d.points[0].z)
                data[1].incrementalID.push(id)
                data[1].uniqueID.push(parseFloat(d.points[0].data.uniqueID[point_number])
                Plotly.redraw(self.$.plot3d)
           } 
        })

Moreover, if i remove the point from the first trace, (so, the clicked point belongs only to the second trace ), the point disappears, so it seems like my second trace during the redraw is not redrawn at all.
Here it is the second snippet:

this.$.plot3d.on('plotly_click', function(d){
  point_number = d.points[0].pointNumber
  var id = parseFloat(d.points[0].data.incrementalID[point_number])
  var index_1 = util.issetArrayElement(data[1].incrementalID,id)
  var index_0 = util.issetArrayElement(data[0].incrementalID,id)
  if(index_1 == -1){          
    data[1].x.push(d.points[0].x)
    data[1].y.push(d.points[0].y)
    data[1].z.push(d.points[0].z)
    data[1].incrementalID.push(id)
    data[1].uniqueID.push(parseFloat(d.points[0].data.uniqueID[point_number]))
    util.removeArrayElement(data[0].x,index_0)
    util.removeArrayElement(data[0].y,index_0)
    util.removeArrayElement(data[0].z,index_0)
    util.removeArrayElement(data[0].incrementalID,index_0)
    util.removeArrayElement(data[0].uniqueID,index_0)
  }
  redrawing = true
  Plotly.redraw(self.$.plot3d)
})

I cannot figure out why

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions