Created
January 9, 2024 17:07
-
-
Save cmdcolin/dc8586541314fa71649123980d215c9f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example code for "hand-drawing the d3-hierarchy on a canvas" | |
for (const { source, target } of hierarchy.links()) { | |
const { x: sy, y: sx } = source | |
const { x: ty, y: tx } = target | |
ctx.beginPath() | |
ctx.moveTo(sx, sy) | |
ctx.lineTo(sx, ty) | |
ctx.lineTo(tx, ty) | |
ctx.stroke() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment