Which JavaScript line‑charts library?

We built the same three line charts in seven libraries, from real data: forty years of oil prices, Britain's electricity grid every half hour since 2009, and weekly npm downloads for 22 charting libraries. We timed them, measured their size and picked one for each job.

7 libraries 3 charts on real data up to 1.25 million points Nov 2026

Brent and WTI oil prices from 1986 to 2026, drawn by Apache ECharts, with callouts for the Iraq invasion of Kuwait, the 2008 all-time high of $143.95, the OPEC price war, WTI at minus $36.98 on 20 April 2020 and Russia's invasion of Ukraine, over grey bands for US recessions Brent and WTI oil prices from 1986 to 2026, drawn by Apache ECharts in dark mode, with callouts for the Iraq invasion of Kuwait, the 2008 all-time high, the OPEC price war, WTI at minus $36.98 and Russia's invasion of Ukraine
Forty years of oil prices, drawn by Apache ECharts. See all seven draw it

What to use

It depends what the chart is for. A pick and a runner-up for each job.

The jobUseRunner-upWhy
An interactive chartA dashboard or an app. Zoom, tooltips, a million points, many series. Apache EChartsApache-2.0, canvas or SVG Plotly.js: zoom and callouts in config, but 1.5 MB, and slow hover on big data until tuned. Met all three tests, mostly with options. 1.25 million points in about 100 ms, with zoom and a slider built in. 368 KB.
A chart in an articleA report, a blog post, a data story. Static and annotated. Observable PlotISC, SVG D3, when you need what Plot can't do. 44 lines for the oil chart, the fewest. Renders to static SVG in Node, which is how DataHub uses it. No zoom or pan.
Huge data, small pageSpeed and size are all that matter. µPlotMIT, canvas D3 drawing to canvas. 1.25 million points in about 25 ms, 23 KB. No callouts, and you write wheel zoom and pan yourself.
A custom chartThe chart is the product. D3 Did everything, all by hand: 1.3 to 2.6 times Plot's code.

For DataHub we chose Plot for data stories and ECharts for interactive charts. Why we did this · The full verdict

The seven, side by side

Ranked for DataHub. Stars and downloads say how safe a bet it is; size and render time, what it costs your page; done for you and code, how much work it is.

#Library Stars · downloadsGitHub · npm, a week Sizegzipped, as loaded 1.25M pointsfirst paint · what it draws Done for youof 11 requirements Codelines, 3 charts Best for
1Apache ECharts68k · 10.5M368 KB103 ms · every point, min–max sampled9185One library for everything
2Observable Plot5k · 1.6M190 KB431 ms · a daily mean and low–high band5½159Charts in articles
3D3114k · 33.6M118 KB69 ms · every point, on canvas1260Custom charts
4Plotly.js18k · 0.9M1,480 KB696 ms · every point, WebGL; slow hover until tuned6½180Callouts and zoom as config
5µPlot11k · 1.0M23 KB24 ms · every point, min–max4256Speed and size
6Chart.js68k · 16.6M122 KB86 ms · every point, min–max decimation5233Keep it if you have it
7Vega-Lite6k · 2.2M283 KB219 ms · a daily mean and low–high band7½191JSON specs, small data

Why the picks differ

Libraries that do more for you tend to draw big data more slowly. ECharts does the most and is still fast.

Filled dots: scripted medians. Hollow dots: Plot and Vega-Lite drawing every point, timed by hand while building; what they ship is a daily step (431 and 219 ms). Drawn with Observable Plot.

The same chart in all seven

Pick a chart; all seven draw it, in our ranking order. Out of the box is what you get on day one. Styled to our brief, they look alike because we made them alike; the Code column above shows how many lines that took.

Try it: 1.25 million points

Britain's electricity generation every half hour since 2009, four series. The buttons show our measured median; the chart times itself in your browser.

Apache EChartsrendered in … in your browser

What we learned

How we tested

  • We have compared charting libraries for DataHub for about a decade; this is the 2026 round.
  • One written brief, the same data and the same page shell for all seven.
  • Timings and sizes come from scripts in the repo; the source is under every chart. Method · Build notes · Why we did this

Questions

Why not Highcharts, Recharts, ApexCharts or Nivo?

Highcharts isn't free for commercial use; everything here is permissive open source. Recharts, Nivo and visx are React wrappers, and this site has no framework. ApexCharts, Chartist, Frappe and billboard.js weren't tested.

I use React. Does this apply?

Yes: all seven mount in a React component the way they mount here. React-only libraries are a separate comparison.

SVG or canvas?

Plot and D3 draw SVG (D3 also draws canvas, and does for the grid). Vega-Lite and ECharts can do either. Plotly draws SVG, and WebGL for big data. Chart.js and µPlot are canvas only. SVG text can be selected and read by screen readers; canvas needs extra work for that.