Skip to content

Instantly share code, notes, and snippets.

@caillou
Created Jul 26, 2012
Embed
What would you like to do?
<!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