Skip to content

Instantly share code, notes, and snippets.

@jarrettmeyer
Last active May 2, 2018 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarrettmeyer/47f5a59c2014fd270878d11adea803f6 to your computer and use it in GitHub Desktop.
Save jarrettmeyer/47f5a59c2014fd270878d11adea803f6 to your computer and use it in GitHub Desktop.
// Define constants.
const width = 800;
const height = 500;
const padding = { top: 20, bottom: 20, left: 20, right: 20 };
// Define our SVG canvas.
let svg = d3.select("svg");
let width = +svg.attr("width") - padding.left - padding.right;
let height = +svg.attr("height") - padding.top - padding.bottom;
svg.append("g").attr("transform", "translate(" + padding.left + ", " + padding.top ")");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment