Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

"Live Figure" - new Graph props for current state of figure #584

Open
@alexcjohnson

Description

@alexcjohnson

Currently the way to respond to zoom events, legend toggle events, etc. is to listen to relayoutData and restyleData. This gets super complicated though since it only contains the latest changes, which may be a partial zoom (single axis, single-ended) or completely unrelated to the information you actually care about. So to make a really robust app, the dev needs to manually accumulate these changes in a Store or something.

It would be way better to just expose the current state of the figure as its own prop. Then, to avoid infinite loops, the normal usage pattern would be to use relayoutData as an Input just to trigger the callback, and use liveFigure or whatever we call it as State.

But of course we don't want the entire figure, we need to at least exclude data arrays as they may be huge and slow things down.

The uirevision system collects attribute patterns that can be set by the UI - we could presumably piggyback off that, though that's reaching fairly deep into plotly.js unless we build this functionality directly into plotly.js. Alternatively we could clone the whole figure minus data arrays - or even just clip all arrays, though there are a few that we need to keep in their entirety (hiddenlabels, selectedpoints...)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions