Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var column = $('#teams_standard_batting td:nth-child(13)')
max = _.max(column.map(function(){ return parseFloat($(this).text()) }))
min = _.min(column.map(function(){ return parseFloat($(this).text()) }))
barwidth = 250
column.map(function(iter,cell){
$(cell).prepend('<div class="bar"></div>');
$(cell).children('.bar').css('width', parseFloat($(cell).text()) / max * barwidth )
var color = d3.scale.linear()
.domain([min, max])
.range(["#c33", "#0fc"]);
$(cell).children('.bar').css('background-color', color(parseFloat($(cell).text())))
})
$(column).css('text-align', 'left')
$('.bar').css('height', '10px').css('float', 'left')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.