How to update axis using d3.js

It looks like you are using the wrong selector while updating the axes:

   svg.selectAll("g .y.axis")
        .call(yAxis);

   svg.selectAll("g .x.axis")
        .call(xAxis);

maybe should read:

   svg.selectAll("g.y.axis")
        .call(yAxis);

   svg.selectAll("g.x.axis")
        .call(xAxis);

Why are you using "g .y.axis"?

Try:

svg.select(".y.axis")
    .call(yAxis);

And similar for x axis.