score:1

Accepted answer

Use nice() in the domain:

y.domain([
    d3.min(chartData, function(n) {
        return d3.min(n.values, function(d) {
            return d.value;
        });
    }),
    d3.max(chartData, function(n) {
        return d3.max(n.values, function(d) {
            return d.value;
        });
    })
]).nice();

Here is your Fiddle: https://jsfiddle.net/c8mjha3o/


Related Query