Skip to content

API for deleting transforms and other new Plotly.js components #1069

Description

@bpostlethwaite

We have an API for adding these things but there is no way to remove them yet.

cc @etpinard

Activity

  1. rreusser commented on Oct 24, 2016

    @rreusser
    Contributor

    Yes, this is a downside of the container array format. One small caveat here is what happens if something references, for example, transform[3].values and you delete transform #2. I think it's possible to overwrite 'transform[2]': {} so that it becomes a no-op, but that's not quite ideal.

  2. bpostlethwaite commented on Oct 24, 2016

    @bpostlethwaite
    MemberAuthor

    As far as writing referencing code I don't see transforms any differently from traces or annotations. Plotlyjs supports deletion in both cases.

    We use UIDs in Plotly application code for exactly this reason. I imagine other application writers are accustomed to doing the same. It adds a layer of indirection (find the index that has a matching UID before making a Plotlyjs call) but it is expected when writing non-trivial applications.

  3. bpostlethwaite commented on Oct 24, 2016

    @bpostlethwaite
    MemberAuthor

    And for trivial cases like single run scripts I doubt deletion is used frequently.

  4. rreusser commented on Oct 24, 2016

    @rreusser
    Contributor

    One possible approach: change nestedProperty array lookup code so that if the array index is not an integer (e.g. transforms[stringId]) then it will look though the array for the object with uid: 'stringId' instead. Ideally that would not affect any existing code, but it's just a little weird. (though are uids just string integers by default?)

  5. rreusser commented on Oct 24, 2016

    @rreusser
    Contributor

    As far as writing referencing code I don't see transforms any differently from traces or annotations. Plotlyjs supports deletion in both cases.

    Oh, wait. I'm confused then. Isn't the API the same for modifying annotations and transforms? Does relayout succeed in deleting them where restyle fails?

  6. bpostlethwaite commented on Oct 24, 2016

    @bpostlethwaite
    MemberAuthor

    There are specific lines of code for dealing with annotations that have not been replicated for transforms. There isn't a general array mutation pathway in relayout or restyle.

  7. rreusser commented on Oct 24, 2016

    @rreusser
    Contributor

    Got it. I understand now. Thanks for clarifying. Those should be replicated; I'll just reiterate quickly my concern about having built a system that may actually include references to the array indices in other potentially-arbitrary places. (like an animation modifying transforms[0].value)

  8. added this to the v1.19.0 milestone on Oct 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething brokenfeaturesomething new

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions