Reputation: 1250
Having a bit of trouble with dc.js.
I have a line chart, for which I am trying to set the maximum ticks. The current graph is as such:
I am trying to customise its x-axis ticks with the following parameters
graph.xUnits(d3.time.days).round(d3.time.day.round)
graph.xAxis().ticks(8).tickFormat(d3.time.format("%m/%d"))
As you can see, the graph is showing more than 8 ticks, and is showing an unnecessary extra value at 08/01.
Any clues as to how this can be resolved? Thanks!
Upvotes: 0
Views: 2485
Reputation: 4218
From the docs on linear.ticks([count])
, which that value is eventually passed to:
The specified count is only a hint; the scale may return more or fewer values depending on the input domain.
d3 doesn't supply a way to specify an exact tick count, save for specifying the ticks yourself. You can generate the ticks yourself, and set them with axis.tickValues([values]).
Upvotes: 2