Accepted answer

Try to empty the axis before build the graph

function ShowGraph(data) {
    var vis ="#visualisation"),

EDIT OK maybe I found the solution

The problem is the axis that appends every time to call the function.

So, if you add a check like so:

var hasAxis ='.axis')[0][0];

if(!hasAxis) {
   vis.append("svg:g") // add a container for the axis
   .attr("class", "x axis") // add some classes so we can style it
   .attr("transform", "translate(0," + (HEIGHT - MARGINS.bottom) + ")") // move it into position
   .call(xAxis); // finally, add the axis to the visualisation

    .attr("class", "y axis")
    .attr("transform", "translate(" + (MARGINS.left) + ",0)")

it should works

Related Query

More Query from same tag