score:2

Accepted answer

2 things:

  xMax = d3.max(data, function (d) {
        return d.x;
    });
    yMax = d3.max(data, function (d) {
        return d.x;
    });

1) csv parsing returns strings by default. It will return the max value as the alphabetically maximum value for x, which is "85" in your data. Look at your screenshot and see where your x axis ends...

2) you're using d.x to calculate the max y value too

Should be:

  xMax = d3.max(data, function (d) {
        return +d.x;
    });
    yMax = d3.max(data, function (d) {
        return +d.y;
    });

Related Query

More Query from same tag