Accepted answer

The problem you're encountering is because of time zone issues. All the dates will be offset by whatever your timezone offset to UTC is. To avoid this, don't rely on new Date() to create Date objects from your strings, but parse them explicitly. D3 provides a function to do this:

var parse = d3.time.format("%Y-%m-%d").parse;

Then you can parse like this:


Complete jsfiddle here.


Your lines match up to 05:00 every day. So I just made the isotime 05:00. Example fiddle.


This fiddle is a little bit more elegant without editing the data.

Related Query