📊D3.js
Also known as D3, Data-Driven Documents, D3 JavaScript Library
A free code tool for the web. You use it to build any chart you want.
Think of it like
It is like a box of LEGO bricks for charts. You can build any chart, but you build it piece by piece.
Example
A news team builds an election map in D3. Readers hover over a county to see its vote count.
Why it matters
It can draw charts no template offers. Many famous interactive news graphics were built with it.
Definition
Example code
javascript
d3.select("svg")
.selectAll("rect")
.data([4, 8, 15])
.join("rect")
.attr("y", (d, i) => i * 22)
.attr("height", 18)
.attr("width", d => d * 10);Common mistake
Key takeaways
- 1Data drives shapes. Values become SVG elements.
- 2No templates. You build each chart.
- 3Web native. SVG, Canvas and JavaScript.