score:2

Accepted answer

I think you may be missing an update action within your code, can you check if this works:

var newData = d3.select("body")
   .selectAll("p")
   .data(newdataset);

// update old data
newData.text(function (d) {return d.YEAR + " " + d.POPULATION});
// insert new data
newData.enter().append("p").text(function (d) {return d.YEAR + " " + d.POPULATION})
// Remove extra data
newData.exit().remove();

Related Query