Skip to content

Instantly share code, notes, and snippets.

@jsrath
Last active November 3, 2018 19:09
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 jsrath/5866ee3ea7ca5f6f4a7b78c8aec8e0d6 to your computer and use it in GitHub Desktop.
Save jsrath/5866ee3ea7ca5f6f4a7b78c8aec8e0d6 to your computer and use it in GitHub Desktop.
const values = data.map(element => element[1]);
const scaleColors = getColor();
let color = d3.scaleLinear()
.domain([d3.min(values), d3.max(values)])
.range(scaleColors);
data.forEach(district => {
d3.select('g#' + district[0])
.attr('fill', color(district[1]))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment