Skip to content

Instantly share code, notes, and snippets.

@russelllim22
Last active September 4, 2021 21:36
Show Gist options
  • Save russelllim22/2c06ef6c1374a7370b15391c099bf6f0 to your computer and use it in GitHub Desktop.
Save russelllim22/2c06ef6c1374a7370b15391c099bf6f0 to your computer and use it in GitHub Desktop.
let xScale = d3.scaleLinear()
.domain([0, 3000]) // my x-variable has a max of 3000
.range([0, 600]); // my x-axis is 600px wide
let yScale = d3.scaleLinear()
.domain([0, 1000]) // my y-variable has a max of 1000
.range([400, 0]); // my y-axis is 400px high
// (the max and min are reversed because the
// SVG y-value is measured from the top)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment