Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Shapes only appear after zoom, not initially

So I’ve added some shapes, which don’t appear initially but only after I zoom, when I zoom back out they’re still present after they’ve appeared.
Code I’ve used:

    var layout = {
                    dragmode: 'select',
                    showlegend: true,
                    yaxis: {
                        // autorange: true,
                        fixedrange: true,
                        tickformat: "0.8f"
                    shapes: (entries ? entries : undefined),
                    xaxis: {
                        autorange: true,
                        fixedrange: false,
                        rangeslider: {
                            visible: false,
      Plotly.newPlot('graph', data, layout, {scrollZoom:true});

Any clues as to how I can resolve this? Thanks in advance!

That shouldn’t happen. Would you mind sharing your entries array to make your snippet reproducible?

1 Like

I just found out that those entries were populated afterwards, since both functions (the one drawing the graph and the one feeding the data into the entries) return promises, I put them in the wrong order :unamused:, so what was happening is that I drew the graph first with no entries, then the entries were populated when the graph was drawn, and then by zooming I probably redrew the graph somehow so that the entries were there. Sorry and thanks again, perhaps someone ends up making the same mistake :smiley:

1 Like