Last active
August 29, 2015 14:03
-
-
Save vicapow/eb5d98e7478042fd4a98 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<script src="http://d3js.org/d3.v3.js" charset="utf-8"></script> | |
<style> | |
body, html{ | |
margin: 0; | |
} | |
</style> | |
<body> | |
<script> | |
var w = window.innerWidth, h = window.innerHeight | |
var svg = d3.select('body').append('svg').attr('width', w).attr('height', h); | |
var data = [ | |
['first line', 'second line'], | |
['second first line', 'second second line'] | |
]; | |
var t = svg.selectAll('text').data(data) | |
.enter().append('text') | |
.attr('y', function(_, i){ return 4 * i + 'em' } ); | |
t.selectAll('tspan').data(function(d){ return d }) | |
.enter().append('tspan') | |
.attr('x', '0.5em') | |
.attr('dy', '1.4em') | |
.text(function(d){ return d}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment