Skip to content

Instantly share code, notes, and snippets.

@philrenaud
Created October 21, 2015 06:43
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 philrenaud/dcc2ac93878f83e4fe7a to your computer and use it in GitHub Desktop.
Save philrenaud/dcc2ac93878f83e4fe7a to your computer and use it in GitHub Desktop.
$('tr').map(function(iter,row){
var max = _.max($(row).children('td').map(function(iter,cell){ return $(cell).text().replace(/,/g,'') }))
var min = _.min($(row).children('td').map(function(iter,cell){ return $(cell).text().replace(/,/g,'') }))
var color = d3.scale.linear()
.domain([min, max])
.range(["#c33", "#0fc"]);
$(this).children('td').map(function(iter,cell){
$(cell).css('background-color', color($(cell).text().replace(/,/g,'')))
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment