javascript - How to make D3 axis label and ticks conditional for date range from a day to some years? -



javascript - How to make D3 axis label and ticks conditional for date range from a day to some years? -

i have d3 graph date range axis can day 5 years. have set tick format based on difference between 2 selected dates , have set fixed ticks 7.

here code:

xaxis = d3.svg.axis() .scale(xrange) .orient("bottom") .tickformat(function(d, i) { var timeformatter = d3.time.format(getxtimeformat(currentdateextents[0], currentdateextents[1], d, i)); homecoming timeformatter((new date(d))); }) .ticks(7)

i have set, unique format each start date, example: 10jun 4am 7am ..10am 11jun 4am... time @ origin starts @ 12 midnight, , first tick after origin generated dispalys 10jun but time @ ticks 10jun or 11jun 1am seems unusual.

how create d3 starts axis @ origin 10jun , each subsequest ticks time value, when starting next day, create tick time 12 am.

this works when selecting 1 day or more 7 days or 6. between these two, ticks not starting midnight, if select 2 or 3 days.

all of issues can solved if d3 supports

.ticks(function(){return d3.time.hours/days/months;},function(){return tickinterval;)).

any suggestion appreciated. thanks

javascript svg d3.js

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -