3 ms·
In my limited experience, I've found that D3 excels interactive graphs / data visualizations. However, when I've tried to use it for interactive math diagrams,
by benrbray 7y ago
In my limited experience, I've found that D3 excels interactive graphs / data visualizations. However, when I've tried to use it for interactive math diagrams, I've found that it doesn't save me much effort. I found it was still necessary to manually track state and enforce geometric constraints. (not mine, but here is an example where d3 doesn't help much: https://observablehq.com/@renatoppl/torus-knots https://observablehq.com/@renatoppl/torus-knots)
Does anyone have tips for getting more mileage out of D3? Or using other tools? I'd be especially curious if anyone's successfully used React+SVG for interactive science/math diagrams.
- rhodysurf 7y agoI have!!! I use d3 and react (and react native!!) together with SVG to create the charts on my site here: https://hopewaves.app https://hopewaves.app I learned from this repo https://github.com/sxywu/react-d3-example/tree/master/src/visualizations https://github.com/sxywu/react-d3-example/tree/master/src/vi... . I have been using this combo for a while now so let me know if you have any questions about it
- swagasaurus-rex 7y agoD3.js doesn't handle any geometry. You have to tell D3 how to position elements manually, like so: `element.attr('x', value)` Because of this, D3 might not be suitable for 3d work. Of course, you could do the math yourself to project 3d shapes onto the 2d plane, but you won't find those sorts of helper functions in D3. Instead, D3 is a collection of tools to help map data to UI elements. It is up to you to use D3's tooling to generate, update, and delete UI elements.