Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created December 17, 2012 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tmcw/4322455 to your computer and use it in GitHub Desktop.
Save tmcw/4322455 to your computer and use it in GitHub Desktop.
Something about d3 I did not understand.
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
body {
font:normal 14px/20px 'Georgia', serif;
}
</style>
</head>
<body>
<div id='container'>
<h1>Something about d3 I did not understand</h1>
</div>
<script src='http://d3js.org/d3.v3.min.js'></script>
<script>
var ol = d3.select('#container')
.selectAll('ol')
.data(['hello'])
.enter()
.append('ol');
var abc = ol.selectAll('li')
.data(['a', 'b', 'c'])
.enter()
.append('li')
.text(String)
.attr('class', String);
ol.select('li.c').text(String);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment