denisemauldin / d3-timeline

D3 timeline
BSD 3-Clause "New" or "Revised" License
168 stars 72 forks source link

Whole day data - how would I change the x axis to date #10

Closed cretace closed 3 years ago

cretace commented 6 years ago

Doing a sort of Gantt chart but my data is in blocks of days. I'm getting there but any idea how I change x axis to show date not times? Even zooming out I still see times. Hmm ok.. I see the axis does not redraw on zoom. This one does: https://github.com/commodityvectors/d3-timeline ..scratch head.. anyway thanks for your code

sharepointmike commented 3 years ago

@cretace @denisemauldin I have the same question. I would like to use dates instead of times. Can someone help me out how to change the code? Would very much appreciate

cretace commented 3 years ago

Hey -I gave up with d3 - dozens of annoying issues. Zoom limits were impossible to specify. Moved to Flot and all works much better - still (unix)time based but not hard to make it only do days. I abandoned zoom and slide of x axis but I think it's possible in Flot.

sharepointmike commented 3 years ago

Thanks for your answer. I try to create a, fairly, simple timeline without zooming. So I try to get it working in d3. I use c3.js for the simple charts, so I already have d3 in place. I general I would prefer to stick to that.

denisemauldin commented 3 years ago

@sharepointmike Are you using d3 version 4?

sharepointmike commented 3 years ago

Hi @denisemauldin, version 4. What I try now is converting my dates to Unix times and changing the format. Would that be the way to go?

denisemauldin commented 3 years ago

@sharepointmike Yes, this is designed to work with unix times in a relative way. Unfortunately this is not meant to display via days, but you might be able to find a tickFormat that would work.

sharepointmike commented 3 years ago

@denisemauldin this format: d3.timeFormat("%d-%m-%y") seems to work.