Giter Club home page Giter Club logo

Comments (3)

mbostock avatar mbostock commented on August 28, 2024 1

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.

nitaku avatar nitaku commented on August 28, 2024

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.

curran avatar curran commented on August 28, 2024

@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.

thm

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.