score:1

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:

parse(d.date);

Complete jsfiddle here.

score:0

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

{"id":190688,"energy":"19518","date":"2013-11-07T05:00:00Z"}

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


Related Query