Skip to content

Instantly share code, notes, and snippets.

@seliopou
Created November 15, 2012 20:01
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 seliopou/4080885 to your computer and use it in GitHub Desktop.
Save seliopou/4080885 to your computer and use it in GitHub Desktop.
Render some dates
var dates = [...],
width = ...,
height = ...;
var xscale = d3.scale.linear().domain([0, dates.length]).range([0, width]);
var canvas = d3.select('#canvas')
.append('svg:svg')
.attr('width', width)
.attr('height', height);
canvas.selectAll('ticks')
.data(dates)
.enter().append('svg:text')
.attr('x', function(d, i) { return xscale(i); })
.text(function(d) { return d; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment