A simple way to make D3.js charts responsive

const svg = d3
.select("#chart")
.append("svg")
.attr("height", 300)
.attr("width", 600);
const svg = d3
.select("#chart")
.append("svg")
.attr("viewBox", `0 0 300 600`)

--

--

--

An ethical designer & developer based in Torbay, UK. Learning and sharing javascript.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Louise Moxy

Louise Moxy

An ethical designer & developer based in Torbay, UK. Learning and sharing javascript.

More from Medium

How to pick a frontend framework

frontend-framework-blog-angry-ventures-James-Harrison

Building Cult.fit Clone in 6 Days

Flatheads Website — Construct Week, Unit 3.

How to style React