Skip to content

Instantly share code, notes, and snippets.

@d3byex
Last active November 25, 2015 20:51
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 d3byex/378d68f27a1cc144aa8a to your computer and use it in GitHub Desktop.
Save d3byex/378d68f27a1cc144aa8a to your computer and use it in GitHub Desktop.
D3byEX 12.1: A First US Map
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="D3byEX 12.1" />
<meta charset="utf-8">
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var width = 950, height = 500;
var svg = d3.select('body')
.append('svg')
.attr({
width: width,
height: height
});
var url = 'https://gist.githubusercontent.com/d3byex/65a128a9a499f7f0b37d/raw/176771c2f08dbd3431009ae27bef9b2f2fb56e36/us-states.json';
d3.json(url, function (error, data) {
var path = d3.geo.path();
svg.selectAll('path')
.data(data.features)
.enter()
.append('path')
.attr('d', path);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment