d3 icon indicating copy to clipboard operation
d3 copied to clipboard

Date-Time range in x-axis in dst mode.

Open Abhi-joshi opened this issue 10 years ago • 1 comments

I am trying to plot a graph where the x axis is formulating according to my selection of datetime range i.e I f I select date from 03-13-2016 00:00 to 03-13-2016 04:00 and if I choose interval of 15 minutes then I am expecting the array of x axis should be like this:

["x", "2016-03-13 00:00", "2016-03-13 00:15", "2016-03-13 00:30", "2016-03-13 00:45", "2016-03-13 01:00", "2016-03-13 01:15", "2016-03-13 01:30", "2016-03-13 01:45", "2016-03-13 02:00", "2016-03-13 02:15", "2016-03-13 02:30", "2016-03-13 02:45", "2016-03-13 03:00", "2016-03-13 03:15", "2016-03-13 03:30", "2016-03-13 03:45", "2016-03-13 04:00"]

This is working fine when auto adjust daylight time in my system is OFF, But when Auto adjustment is ON Then the duration between 2 am to 3 am is missing because it is a march month. So the array is formulating like this

["x", "2016-03-13 00:00", "2016-03-13 00:15", "2016-03-13 00:30", "2016-03-13 00:45", "2016-03-13 01:00", "2016-03-13 01:15", "2016-03-13 01:30", "2016-03-13 01:45", "2016-03-13 03:00", "2016-03-13 03:15", "2016-03-13 03:30", "2016-03-13 03:45", "2016-03-13 04:00"]

Even though this is a expected behaviour, but I want a 24 day scale regardless the time is in DST or Non DST.

How can we acheive this?Any help will be greatly appreciated. Thanks.

Abhi-joshi avatar Sep 06 '16 09:09 Abhi-joshi

If you want to ignore daylight savings, you probably want to use UTC instead of local time, and hence d3.scaleUtc instead of d3.scaleTime.

If you have further questions, please use Stack Overflow tag d3.js to ask for help. Although I make an effort to assist everyone that asks, I am not always available to provide help promptly or directly. Stack Overflow provides a better collaborative forum for self-help: tens of thousands of D3-related questions have already been asked there, and some answered questions may be relevant to you.

If you have a question about D3’s behavior and want to discuss it with other users, also consider the d3-js Google Group or joining the d3-js Slack.

Thank you! 🤗

mbostock avatar Sep 06 '16 14:09 mbostock