Hi, the Y range is just 0-5: so the graph renders automatically 2 things I don't need:
How can avoid those both?
I solved my problem of fractionals values with
tick: {
format: function(d) {
return d3.round(d); //this wil round the number (1.5 will be rounded to 1)
}
}
But you should try to use the format function d3.format("d")
More info here in the d3 formatting documentation
Greetings
it works indeed with
tick: {
format: d3.format("d")
}
thanks
yes, it works but it still shows the ticks for those floating values. So I think this option only hides label for the floating values:

How can I stop generating it? i.e not just hiding labels.
Here is the complete code which I'm using:
c3.generate({
bindto: '#user-reg-linechart',
data: {
x: 'x',
columns: [
registrationDates,
registrationCount
]
},
axis: {
x: {
type: 'timeseries',
tick: {
format: '%Y-%m-%d'
}
},
y: {
min: 0,
tick: {
format: d3.format('d')
},
padding: {top: 0, bottom: 0}
}
}
});
@ParthVora777 Did you find your solution?
I'm facing the same issue as @ParthVora777 pointed out. Does anyone have a solution?
tick: {
// format: d3.format('d')
format: function(d) {
if (Math.floor(d) != d){
return;
}
return d;
}
},
This turns my chart Y axis looks like:

Ref: https://stackoverflow.com/questions/12643591/how-to-limit-d3-svg-axis-to-integer-labels
Most helpful comment
yes, it works but it still shows the ticks for those floating values. So I think this option only hides label for the floating values:
How can I stop generating it? i.e not just hiding labels.
Here is the complete code which I'm using: