Reputation: 3033
I made bar chart that has x-axis on time based and It worked with tickValues().
xAxis.tickFormat( customTimeFormat )
.tickValues( xScale.domain()
.filter( function( d, i ) {
// return true or false by some process
});
It works well as I expect, but when I made axis with ticks, it didn't work.
xAxis.tickFormat( customTimeFormat ).ticks(4);
How should I set ticks in axis?
Upvotes: 0
Views: 826
Reputation: 86
You could try to set ticks as a time intervals
xAxis.tickFormat(d3.timeFormat("%H:%M")).ticks(d3.timeHour, 1);
This code create ticks for each hour on a timeline. Also can be changed to d3.timeDay, d3.timeMonth, etc.
Upvotes: 2