Skip to content

Instantly share code, notes, and snippets.

@caillou
Created July 26, 2012 12:16
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 caillou/3181719 to your computer and use it in GitHub Desktop.
Save caillou/3181719 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<style type="text/css">
path {
fill: none;
stroke: black;
}
</style>
</head>
<body>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript">
var data = [
{date: new Date(2012,1,1)},
{date: new Date(2012,5,1)}
];
var xExtent = d3.extent(data, function (d) {
return d.date;
});
var xScale = xScale = d3.time.scale()
.domain(xExtent)
.range([0, 700]);
var xAxis = d3.svg.axis()
.scale(xScale)
.ticks(9);
var svg = d3.select("body").append("svg")
.attr("width", 700)
.attr("height", 50)
.append("g")
.call(xAxis);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment