Reputation: 110382
Is there a way in c3.js to format the axis to give it 'nice' values. Such as the X-axis starts at 0
and goes by 500
increments to the max value of 2000?
Upvotes: 0
Views: 3718
Reputation: 446
let categories = ['none', 'small', 'medium', 'large', 'huge'];
....
tick: {
values: [0, 500, 1000, 1500, 2000],
format: function (d) { return categories[d/500]; }
}
Upvotes: 0
Reputation: 41075
You could use axis.x.tick.values
(http://c3js.org/reference.html#axis-x-tick-values)
...
axis: {
x: {
tick: {
values: [0, 500, 1500, 2000]
}
}
}
...
Upvotes: 2