I have a d3 bar chart whose values range from 0-3. I would like the y-axis to only show integer values, which I can do by
var yAxis = d3.svg.axis().scale(y).
You could add .ticks(4) and .tickSubdivide(0) as I've done below:
var yAxis = d3.svg.axis() .scale(y) .orient("right") .ticks(4) .tickFormat(d3.format("d")) .tickSubdivide(0);