US Rainfall Part 4 — setting up SVG viewport with margins
Previous Lessons
- Remove Characters from Beginning of JavaScript String
- Divide Large Data Set into Smaller Data Sets
- Handling Radio Buttons in D3.js
Steps
- set constants for width and height
- set margin as object
- set constants for svgWidth and svgHeight
- select
body
append svg, add attributes for width and height - append SVG group
g
and then translate chart chart by the appropriate margins
Hint: translate
is an attribute of transform