Comments (7)
Neither does this work:
jointprob/jointprob-shadow-cljs@042c593
from oz.
I experimented with using the "componentWillUnmount" as suggested in the clojureverse thread hook but it is not called when vegaEmbed replaces one graph with another.
I did eventually find the react-vega npm library which can be used to create a react component out of a vega or vega-lite spec and data. Whatever this component is doing under the hood it doesn't appear to be leaking memory see:
https://jointprob.github.io/jointprob-shadow-cljs/memory-efficiency-2.html which uses react-vega
In comparison to:
https://jointprob.github.io/jointprob-shadow-cljs/memory-efficiency.html which uses the oz vega-lite react component.
from oz.
@jamiepratt Thanks again for bringing this up and working on a fix!
The problem may be that the component is not technically unmounting, but just "updating". So perhaps we need componentWillUpdate
to do this in addition to componentWillUnmount
.
Thanks again!
from oz.
There is a react-vega component maintained as part of the vega project that recompiles a changed spec or uses view.change when only the data changes:
from oz.
Discussing with jsa-aerial, Hanami maintainer, here: https://clojurians.zulipchat.com/#narrow/stream/210075-saite-dev/topic/animated.20vega-lite.20graphs/near/303463351
from oz.
Hey @jamiepratt. Sorry for the delayed response.
I actually want to do something similar to regarding calling view.change
when just the data changes (see #95). I suspect that this will be much more efficient for us in ClojureScript as well, due to equality checks being more efficient with persistent data structures.
In previous discussions, I didn't realize that part of your problem was that you were trying to create an animation. Presumably just the data is changing between frames then? If this is the case, you could take advantage of Oz's :view-callback
option to grab the vega view
object, and use the view.change
method yourself to update just the data. Please let me know if this makes sense.
Don't supposed you've tried updating your code to use componentWillUpdate
, did you?
Thanks again!
from oz.
PS I've used the react-vega project in the past from vanilla JS, and had issues with it. It may have gotten better now that it's part of the official vega project, but I think there are still likely to be advantages in having our own reagent adapter; We've got enough of our own Clojurisms for managing state changes & flow that having direct access is useful. I also don't like depending on react libs when I can to avoid issues with versioning.
from oz.
Related Issues (20)
- Support streaming data into a visualization via core.async chan
- More idiomatic support for reactive data updates (via reagent atom/reaction data inputs)
- More idiomatic support for reactive Vega signals (as reagent atoms/reactions)
- Add option to ingest clj file comments as markdown
- Add function for setting global compile option defaults
- Progressively stream clj file and markdown block evaluations to client
- Stop using prewalk on client for applying components to hiccup docs
- Live-reloading styles
- Add cli
- Oz does not seem to respect the xOffset setting HOT 5
- Clarify that 1.6.0-alpha36 is the current version HOT 2
- Bump vega-lite to 5.2.0 HOT 1
- live-view! function should work on directories HOT 3
- export! error with png
- WARN Missing type for channel "order", using "quantitative" instead.
- Issues using spec with new notebook features
- rebuilding when output file is missing (but input has not changed)
- Unable to embed static rendering on Windows HOT 6
- Incorrect rendition when using `oz/view!`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oz.