d3.js - evenly spaced bars on a time scale
I'm building a bar plot in d3.js in which each bar represents total TB cases during a month. The data essentially consists of a date (initially strings in %Y-%m format, but parsed using d3.time.format.parse) and an integer. I'd like the axis labels to be relatively flexible (show just year boundaries, label each month, etc.), but I'd also like the bars to be evenly spaced. I can get flexible axis labeling when I use a date scale: var xScaleDate = d3.time.scale() .domain(d3.extent(thisstat, function(d) { return d.date; })) .range([0, width - margin.left - margin.right]); ... but the bars aren't