Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to stream or update data in a viz #95

Closed
metasoarous opened this issue Mar 5, 2020 · 7 comments
Closed

Ability to stream or update data in a viz #95

metasoarous opened this issue Mar 5, 2020 · 7 comments

Comments

@metasoarous
Copy link
Owner

metasoarous commented Mar 5, 2020

This means one (or more) of:

  • Exposing the vega-view instance somehow on component instantiation (maybe via a callback)
  • Accepting a data stream channel as input to the reagent component
  • Doing something fancy with will-component-update to check if the viz spec has changed, or just the data piece

This dovetails with #94.

@Folcon
Copy link
Contributor

Folcon commented Mar 10, 2020

Just been thinking, does the function approach outlined in the docs here mean that I could use a reagent atom to feed in data without triggering a full rerender?

Or have I misunderstood this?

@metasoarous
Copy link
Owner Author

Hi @Folcon. Thanks for asking to clarify.

I'm after a resolution of this issue which would make it possible to use a ratom as your {:data {:values _}}, yes.

While this is pretty optimal performance wise, I can also try doing a check to see whether any other parts of the passed in spec have changed when you (dissoc spec :data). If it hasn't, then I could automatically used a cached instance of the vega view and just update the data with .data. I would imagine this to be a good general optimization users would get for free (though profiling may be required to see where its worth it).

Hope this answers your question. Please let me now if it would be helpful for me to clarify further.

Thanks again!

@Folcon
Copy link
Contributor

Folcon commented Mar 13, 2020

That would be great, spent a bit of time looking into this, it seems you'll want to use something like streaming functionality?

Do you have a clear idea how you want to do this? Not really too familiar with vega myself so not sure how best to achieve it.

The only other way I could see to do it is to use the fact that you can hand it a data url, and perhaps dynamically build a blob and point it at that, doubt it would be very performant though...

@pjlegato
Copy link

pjlegato commented Feb 7, 2021

Is there any workaround that could allow streaming data now?

@metasoarous
Copy link
Owner Author

@pjlegato @Folcon Hi folks. Thanks again for your thoughts on this.

Just wanted to update you that as of #167 (commit: 747187e), it's now possible to stream data by passing a :view-callback function to the reagent components, which will be passed the vega view object, once the visualization is instantiated. This gives you full access to the view API, which supports streaming, and can be used for more granular data/signal updates (and listening). So with that, I'm closing this issue.

However, this admittedly isn't the most idiomatic API in the context of a reagent app, so I'm peeling off #172, #173 and #174 to tease apart ways this could be improved.

Thanks again!

@Folcon
Copy link
Contributor

Folcon commented Oct 20, 2021

Thanks @metasoarous, I'll give this a go when I have a chance next weekend =)...

@metasoarous
Copy link
Owner Author

Great; Please let me know how it goes! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants