I am not very fluent with D3, and have a need to make time axis labels of particular kind. I have timestamp data as X axis, and need axis to indicate year, month, day and then hours . If midnight is included, then again month and day (without year) if possible, or again year+month+day.
The event I depict on my graph lasts for day or several, so ticks are with semi-hourly interval. Yet as I said above, I need dates indication at start of graph and at all midnights.
So far I tried something like
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom").tickFormat(d3.time.format("%Y %M %d %H"));
but with no apparent result (I still getting just hours).
It would be better if you could create a simple fiddle for it.
according to wiki, year, month, day + hours should be:
d3.time.format("%Y/%m/%d %H")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.