Skip to content

Shapes not deleted when clearing all shapes #464

Closed
@aaliddell

Description

@aaliddell

Hi,

I've come across an issue in the recent version whereby calling Plotly.relayout to remove all shapes (i.e shapes: []) does not remove the shape svg elements. Is there a check somewhere that is bailing out when shapes.length == 0, without first checking if there are elements to remove?

In this example, the red shape should be removed by the call to relayout with an empty shapes array: http://codepen.io/anon/pen/pyZPxX

In this example, using a non-empty shapes array in relayout results in the expected behavior (red removed, blue added): http://codepen.io/anon/pen/XdBRym

This worked in prior versions, so has there been a change in the advised method of removing all shapes? The current workaround I'm having to use is to add a tiny invisible shape when I want to remove all other shapes, which is a bit of a bodge.

Edit: As as addition: shapes that are present when calling Plotly.relayout with shapes: [] appear to be orphaned and never cleaned up in subsequent calls to relayout, even when the shapes array is non-empty. Meaning the chart ends up covered in old shapes.

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