reate / update the plot for a given variable:
function update(data) {

  // Update the X axis
  x.domain(data.map(d => d.group))
  xAxis.call(d3.axisBottom(x))

  // Update the Y axis
  y.domain([0, d3.max(data, d => d.value) ]);
  yAxis.transition().duration(1000).call(d3.axisLeft(y));

  // Create the u variable
  var u = svg.selectAll("rect")
    .data(data)

  u
    .join("rect") // Add a new rect for each new elements
    .transition()
    .duration(1000)
      .attr("x", d => x(d.group))
      .attr("