D3 transitions not working
<p>I'm having an issue getting my transitions to work between datasets. I would like the numbers, rectangles and names to smoothly transition between eachother when the button is clicked, but at present they only jump.</p>

<p>I'm using them like this</p>

<pre><code>players.select('.saves')
 .transition().duration(200)
 .attr('y', function(d, i) {
         return i * (h / data.length);
 })
 .attr('width', function(d) {
      return Scale(d['saves']) ;});
</code></pre>

<p>Is the problem with my selections?</p>

<p><a href="https://jsfiddle.net/8voee4fm/1/" rel="nofollow">https://jsfiddle.net/8voee4fm/1/</a></p>

<pre><code>&lt;button class="opts champ" value="championsleague"&gt;Champions League&lt;/button&gt;
&lt;button class="opts prem" value="premierleague"&gt;Premier League&lt;/button&gt;

&lt;div id="chart"&gt;&lt;/div&gt;

var w = 300, h = 300;
var barHeight = 20;

var data = 

championsleague = [{
    "name": "Hart",
    "saves": "9",
    "total": "15",
  }, {
    "name": "Subasic",
    "saves": "6",
    "total": "10"
  }, {
    "name": "Neuer",
    "saves": "5",
    "total": "9"
  },{
    "name": "Olsen",
    "saves": "9",
    "total": "18"
  }, ];

premierleague = [{
  "name": "Hart",
  "saves": "12",
  "total": "27"
}, {
  "name": "Forster",
  "saves": "13",
  "total": "22"
}, {
  "name": "De Gea",
  "saves": "17",
  "total": "29"
}, {
  "name": "Green",
  "saves": "21",
  "total": "39"
},];

data.forEach(function(d){
  d.saves = +d.saves;
  d.total = +d.total;
});

var canvas = d3.select('#chart')
.append('svg')
.attr('width', w)
.attr('height', h)
.append('g')
.attr("transform", "translate(10,30)");

var Scale = d3.scale.linear().domain([0, 39]).range([0, w]);

function updateLegend(data) {

var players = canvas
 .selectAll(".player")
  .data(data, function(d){
   // always create a unique key for your data-binding
     return d.name + d.saves + d.total;
  });

var playersEnter = players
 .enter()
 .append("g")
 .attr("class", "player");

playersEnter.append('rect')
  .attr('class','total')
  .style("fill", "#abcbc0")
  .attr('x', 0)
  .attr('height',  barHeight);
playersEnter.append('text')
  .attr('class','totaln')
  .style("fill", "black")
  .style("text-anchor", "right");
playersEnter.append('rect')
  .attr('class','saves')
  .style("fill", "#008c6c")
  .attr('x', 0)
  .attr('height',  barHeight);
playersEnter.append('text')
  .attr('class','savesn')
  .style("text-anchor", "right")
  .style("fill", "white");
playersEnter.append('text')
  .attr('class','name')
  .attr('x', 0);

players.select('.total').transition()
  .duration(200)
  .attr('y', function(d, i) {
    return i * (h / data.length)
  })
  .attr('width', function(d) {
        return Scale(d['total']) 
  })
  .attr('height',  barHeight);

players.select('.totaln').transition()
 .duration(200).text(function(d) {
      return d.total;
 })
 .attr('x', function(d) {
      return Scale(d['total']) -20})
 .attr('y', function(d,i) {
       return i * (h / data.length ) +15
 });

players.select('.saves')
 .transition().duration(200)
 .attr('y', function(d, i) {
         return i * (h / data.length);
 })
 .attr('width', function(d) {
      return Scale(d['saves']) ;});

players.select('.savesn')
 .transition()
 .duration(200).text(function(d) {
      return d.saves;
  })
 .attr('x', function(d) {
      return Scale(d['saves']) -18})
 .attr('y', function(d,i) {
        return i * (h / data.length ) +15
 });

  players.select('.name')
    .transition().duration(200)
    .text(function(d) {
      return d.name;
    })
    .attr('y', function(d, i) {
         return i * (h / data.length) -10
    });

 // remove old elements
 players.exit().remove();

};

    updateLegend(data);

    d3.selectAll('.opts')
    .on('click', function() {
    var data = eval(d3.select(this).property('value'));
    console.log(data)
    updateLegend(data);
  })
</code></pre>