npmd3v7.9.0
npmAdvanced

d3

The most powerful data visualization library for the web — bind data to SVG/Canvas elements and transform them with scales, axes, and layouts.

visualizationsvgchartsdata-scienceanimation
The Problem

You need a chart that no charting library supports, or you want complete control over every pixel of your visualization. Libraries like Chart.js or Recharts are constrained — d3 gives you the raw building blocks.

Mental Model

d3 is not a charting library — it's a DOM manipulation + data transformation toolkit. The core pattern: select elements, bind data (.data()), then enter/update/exit the joined selection. Built-in: scales (map data domain → visual range), axes, shape generators, and force/tree/hierarchy layouts.

60-second start

Use it when

Custom visualizations that no library supports, journalism/scrollytelling data stories, network graphs, geo maps, animated transitions between data states, or when you need to own every detail.

Skip it when

Standard bar/line/pie charts in a product (use Recharts or Chart.js — they're 10x faster to implement). d3's learning curve is steep.

Alternatives
rechartsReact chart library built on d3, much easier for standard charts
chart.jsCanvas-based, easy to use, standard chart types
observable-plotFrom d3 creator, high-level grammar-of-graphics API

Ready to explore the full API?

See every class, function, and relationship in an interactive graph.