I have a d3 chart with an x axis that uses its own time format:
var x = d3.time.scale.utc()
.domain([start, end])
.range([0, width]);
var customTimeFormat = d3.time.format.utc.multi([
["%b %d", function(d) { return d.getUTCDate() != 1; }],
["%b", function(d) { return d.getUTCMonth(); }],
["%Y", function() { return true; }]
]);
var xAxisTop = d3.svg.axis()
.scale(x)
.orient("top")
.tickFormat(customTimeFormat)
.innerTickSize(-height)
.outerTickSize(0)
.ticks(d3.time.month.utc, 1);
What I would like to have is to make a mark for every month, but only a label for every third month. However, all I can do is to either (a) have a tick and a label for each month, or (b) have a tick and a label for every third month.
How can I specify to do ticks every month, but only tags appear on every third month?
source
share