Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT! custom menu loses layout.shapes

I’ve made a custom menu for plotly but something strange is happening.
As you will see in the code pen console at the third click the shapes array of the layout object dissapear.

Thanks in advance for your time,

I solved it adding this code but i dont think if this is the solution:

if (typeof (layout.shapes) == "undefined") {
        layout.shapes = [];


I’m not sure if it shows the desired behavior, but using targeted relayout signatures should help manage how many shapes there are on your graph.

1 Like

Thanks a lot etienn. I need to learn more javascript :wink:

1 Like