google / deps.dev

Resources for the deps.dev API
https://deps.dev
Apache License 2.0
258 stars 20 forks source link

[Question] The graph from deps.dev is cool; is it a reusable component? #20

Closed Enoumy closed 1 year ago

Enoumy commented 1 year ago

Hi!

I have a small, curiosity question on the implementation of the graph UI. Feel free to close this issue if this is not the right place to ask.

I think the draggable interactive graph visualization is very cool. [1]. Is the graph a reusable component / a part of some other UI library? Is it a private graph implemented specifically for deps.dev?

[1] https://deps.dev/cargo/tokio/1.28.1/dependencies/graph

Thanks! Enoumy

sarnesjo commented 1 year ago

Hi, and thanks! The graph component as a whole is custom and not easily reusable, although it is built on top of a number of excellent D3 libraries. Most of the heavy lifting is done by d3-force, with zooming and panning provided by d3-zoom and d3-drag, and additional rendering logic provided by d3-selection.

If you want to build something similar, I'd recommend taking a look at these examples: