-
-
Save sosukeinu/c9f9393fd001a5bc7081 to your computer and use it in GitHub Desktop.
Gist to accompany my "How to make Tufte's discrete sparklines using d3.js" at http://dataviztalk.blogspot.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var boston_record = [ | |
['home', 'win'], | |
... | |
['away', 'loss'], | |
]; | |
d3.select('#second-wrapper-main') | |
.selectAll('div') | |
.data(boston_record) | |
.enter().append('div') | |
.attr('class', 'drawn-line') | |
.attr('data-binary-var', function (d) { | |
if (d[1] === 'win') { | |
return 1; | |
} | |
else { | |
return 0; | |
} | |
}) | |
.style('left', function(d, i) { return i * 4 + 'px';}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment