psygo
psygo
Explore posts from servers
SSolidJS
Created by psygo on 8/17/2023 in #support
D3 Force Graph in SolidJS with TypeScript
I've originally asked this on StackOverflow.
D3 seems so complicated to make work with basically any framework... Specially when it comes to TypeScript, since they apparently keep changing their APIs, rendering so many past examples from gists and other posts close to useless. At the moment, I would like to make work with TypeScript and SolidJS the canonical force graph example. I feel like trying to solve a jigsaw puzzle since a lot of the types just won't match. The one I've had the most trouble with was the drag() arguments, I believe. I've also tried simply ignoring types, of course, but I couldn't make it work either. Also, does anyone know if it is possible to append any arbitrary component as a graph node? --- References 1. D3 - Force Directed Graph 1. Easily show relationships — Draw Simple Force Graph with React & d3 utilizing TypeScript 1. Building D3 interactive network graph D3 Force-Simulation + React + TypeScript 1. mbostock's Gist 1. steveharoz's Gist with Full Controls
10 replies