bcliang / dash-extendable-graph

Graphing component for Dash. Forked from the core Graph component, with modified extend/prepend properties to accept data formats matching `figure["data"]`
MIT License
10 stars 0 forks source link

Imply trace indices from `name` attribute #75

Open nirvana-msu opened 2 years ago

nirvana-msu commented 2 years ago

The doc page is a little misleading saying that updateData contains data:

... in a format matching figure['data']

Specifically, I naively thought I could include trace name there and it would figure out the correct trace to append data to (or create new):

dict(x=[1], y=[1], name='Trace 1')

That works on initial load (because it just creates a new plot) however on subsequent updates it fails because it assumes trace indices are simply linearly increasing, and also because passing name to extendTraces throws an error.

It would be very convenient if that was handled automatically, namely: