Comments (3)
There are a few tricks that might be helpful.
You can use custom DOM elements to represent your scenegraph, and then write code to render this however you like to canvas whenever the DOM changes: http://bl.ocks.org/mbostock/1276463 (That example uses d3.timer to redraw continuously, but with some additional effort you could make it more efficient.)
You can use X3DOM: http://bl.ocks.org/hlvoorhees/5986172 I believe this technique is similar to the above, but I don’t know how X3DOM is implemented.
You can select arbitrary objects rather than elements, say to manage transitions rendered to Canvas without using the DOM: http://bl.ocks.org/mbostock/9539958
More generally, I think it’s reasonable to apply the concepts of D3 to other types of scenegraphs. But I don’t think it makes sense to try to make d3-selection more generic than it already is—my intuition is that this could make the API harder to use in the common case of using the DOM. So, if you are interested in this approach I would start by making a fork or building something D3-like from scratch. If you discover an elegant approach, by all means let me know and we can discuss whether it’s something that makes sense to merge back in. 😁
from d3-selection.
Thanks a lot, I'll have a look at the examples and think about ways to accomplish what I suggested. If I come up with something worthwhile, I'll let you know. :)
from d3-selection.
@nitaku For what it's worth, I recently tried working with Leaflet for interactive visualizations and have run into exactly this issue - I found myself wishing I could use the D3 enter/update/exit logic applied to Leaflet markers.
Here's an example that illustrates the need: Migrant Deaths over Time.
Brushing in the date view filters the data shown in the map view. In this implementation, all the markers are removed and new ones are re-created every time the user brushes. This is a quick and dirty solution, and I thought about implementing a D3-like enter/update/exit sort of thing to improve the performance.
However, ultimately it may be best to use D3 for the map component as well and not use Leaflet at all, which I think is the direction I'm heading for future work.
from d3-selection.
Related Issues (20)
- How to add passive listener into zoom event? HOT 1
- Proposal: add sample code for transitions into README docs HOT 1
- How to report type issues HOT 1
- d3.style('padding') or d3.style('margin') returned empty string only in firefox HOT 2
- Adopt InternMap for selection.data
- Stash the key used by the previous data-join HOT 2
- Raise an error when passing a `selection.data()` key that does not evaluate to a string. HOT 1
- Selection.one HOT 12
- Please provide your artifact as transpiled (CJS) code. HOT 3
- Enable the use of d3.join() without implicit d3.order() call HOT 3
- selection.appendAll HOT 3
- Is anyone working on D3.ts ? HOT 1
- chaining multiple transform styles to an element do not all get applied to the element HOT 1
- Proposal: Memoization Utility HOT 4
- Error: path attribute d expected number, on value with scientific notation HOT 2
- Chaining select has a side-effect on data HOT 1
- `pointer.js` function is not available for import through `d3-selection` HOT 8
- .attr on null selection should not error HOT 3
- Missing null check HOT 1
- Cannot import {pointer} function as it is not available to import HOT 4
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 d3-selection.