score:1

Accepted answer

I'm not sure how d3 will coerce your date strings into dates so I'd suggest converting them explicitly. I think that should fix your problem.

First in the source data e.g.

  var timeFormat = d3.time.format("%m/%d/%Y");
  var cd = data.filter(function(d) {
    return (d.Style == "solo")
  })
  .map(function(d){
    d["starting date"] = timeFormat.parse(d["starting date"]);
    d["arrival date"] = timeFormat.parse(d["arrival date"]);
    return d;
  });

And then similarly when you create your domain...

var x = d3.time.scale()
  .domain([timeFormat.parse('11/18/1992'), timeFormat.parse('10/25/2013')])
  .range([0, w]);

To determine the extent of the dates automatically you could use d3.array.extent (docs)


Related Query