score:1

Accepted answer

So the first bar, the one that you're having issues with, is based on this data:

{
  "start": "2016-11-14 20:00",
  "end": "2016-11-14 23:59"
},

And you're positioning it based on its endtime, which is derived like

d.endtime = d.end.getHours();

So, that's the issue: if you get the hour of 23:59, it's 23, not 24: JavaScript doesn't round to the nearest hour, it just takes the hour part. If you want a more accurate y-axis, you can:

  • Use something that isn't hours, like minutes or seconds.
  • Create a time scale for each bar with its domain set to midnight before / after the bar's time range.

Related Query

More Query from same tag