Wordcloud animation sorted data

by kzoon

HTML

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/wordcloud.js"></script>
<div id="container" style="height: 600px"></div>
<button id="update">Update chart</button>

JavaScript

var chart = Highcharts.chart('container', {

  "chart": {
    "type": "wordcloud",
  },
  "title": {
    "text": ""
  },
  "tooltip": {
    "enabled": true,
  },
  "plotOptions": {
    "wordcloud": {
      "style": {
        "fontFamily": "Impact"
      },
      "colors": ["rgba(68,114,196,1)", "rgba(237,125,49,1)", "rgba(165,165,165,1)", "rgba(255,192,0,1)", "rgba(91,155,213,1)", "rgba(112,173,71,1)"],
      "rotation": {
        "orientations": 1,
        "from": 0,
        "to": 0
      },
    }
  },
  "series": [{

    "data": [{
        "name": "USA",
        "weight": 7578,
      },
      {
        "name": "EastAust",
        "weight": 4670
      },
      {
        "name": "SouthReg",
        "weight": 3120
      },
      {
        "name": "Canada",
        "weight": 2999
      },
      {
        "name": "CntlAust",
        "weight": 1804
      }
    ]
  }]

});

var newData = [{
    "name": "USA",
    "weight": 7456
  },
  {
    "name": "EastAust",
    "weight": 4688
  },
  {
    "name": "SouthReg",
    "weight": 3229
  },
  {
    "name": "Canada",
    "weight": 3079
  },
  {
    "name": "CntlAust",
    "weight": 1895
  }
];

$('#update').click(function() {
  chart.series[0].setData(newData, true);
});