Comments (3)
@prook Thank you for opening up this discussion! I think that is a fantastic question.
I think ultimately it comes down to a matter of taste, and so the following is just my personal preference:
I agree with the recommendation by re-frame that using lifecycle hooks to load data is overloading the responsibility of the view layer.
So if your preference is to start and stop websocket via lifecycle hooks, to proceed with with wrapping rid3/viz
in another component, even though I do agree it is a slight bodge. The reason for this is because I would prefer to limit the surface area of rid3 if possible and other (not-too-painful) solutions exist.
Anyways, just wanted to give my initial take on this topic, but I am happy to discuss it further.
from rid3.
True, data retrieval seems inappropriate in the view layer.
But what about something bound to the view more tightly? d3-force simulation, for instance. Lifecycle of js/d3.forceSimulation
should be pretty much bound to rid3/viz
's, and the sim should be invisible to the world outside the component as well. The simulation should initialize on component mount, update nodes/links/whatnot on rid3/viz
's ratom
change, and stop on component unmount. I think no matter what solution to d3-force sim I (we?) come up with, the finer lifecycle control may be needed.
I didn't mention d3-force initially to avoid digression, but now it seems unavoidable. Also, I thought finer lifecycle control could be good for other scenarios as well, but I fail to come up with examples (and if I do, they're easily dismantled) -- all lifecycle work not related to D3 (e. g., WebSockets) can be done outside rid3
.1
But D3 stuff cries to be in rid3
, doesn't it?
So the question is, are there any other parts of D3 toolbox that could use finer lifecycle control? Or will this boil down to finding how to implement d3-force properly in #10 (and the digression was this whole issue)?
1 And also it gave me -- well, gives me -- quite a headache to figure out a how to plug in the simulation. I've found a few solutions which do work, even with GUP and nodes properly merging in the sim
object, but they are hairy to say the least.
from rid3.
@prook Thanks for following up!
I think you have convinced me that we should open up the api and add more lifecycle hooks to things like svg.
So if you are willing to cook up some patches for that, I'd be happy to review it!
Also, regarding force simulation specifically #10 , I haven't had time to look in to that. If you have a minimal, working example with rid3, it would be nice to see ... and then more to the point, we can brainstorm on what we can do to improve it!
from rid3.
Related Issues (11)
- Idea: interactive doc/article about `rid3` HOT 2
- How to use d3 force simulation? HOT 26
- Adding events to pieces HOT 2
- feature request: For performance reason, add a path options on the pieces HOT 3
- "d3 is not defined error" when starting out HOT 5
- Can I add a <defs> tag to the SVG? HOT 1
- Pieces should support setting an id HOT 6
- rid3's demo index.html is leaking downstream HOT 1
- Why is the data passed to :elem-with-data required to be in ":dataset" HOT 2
- Use rid3 pie example with cljs advanced code optimizations fails HOT 2
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 rid3.