Next
Prev
Default

This sample WordCloud chart demonstrates how to change word data dynamically using the JavaScript Timer. This sample changes the weight of data every 6,000 milliseconds.

...
  <WordCloudChart >
    <series>
      <WordCloudSeries  textField="text" weightField="value" >
        ...
      </WordCloudSeries>
    </series>
    ...
  </WordCloudChart>
...

function chartReadyHandler(id) {
  document.getElementById(id).setLayout(layoutStr);
  document.getElementById(id).setData(makeData());

  setTimeout(changeData, 6000);
}

function changeData() {
  document.getElementById("chart1").setData(makeData());
  setTimeout(changeData, 6000);
}

function makeData() {
  var i, n,
      chartData = [],
      data,
      datas = ["PRAY","NEW","DO","DESIGN","CONCENTRATE","GREAT","LEAD","MOMENT","LOVE","DO","NEW","PRAY","GREAT","DESIGN","CREATIVE","LOVE","STUNNING","PRAY","BABY","LOVELY","DESIGN","GET","GOOD","NEW","COMMUNICATE","LOVE","NEW", "SUCCESS","LOVELY","LOVE","LEARN","PRAY","LOVE","COOL","DO","LOVE","GORGEOUS","HAPPY","GOAL","STORY","LOVE","STUNNING","COMMUNICATE","PRAY","GREAT","HAVE","LOVE","PEOPLE","MIRACLE","COMMUNICATE","WALK","LOVE","DO","COOL","WALK","PRAY","LIKE","LOVELY","NEW","DESIGN","TEACH","LOVE","DO"];
		
  for(i = 0, n = datas.length ; i < n ; i += 1){
    chartData.push({
      text : datas[i],
      weight : Math.floor(Math.random(10) * 100)
    });
  }
  
  return chartData;
}

<WordCloudSeries>

textField The textField attribute is used to set the field name for text data.
weightField The weightField attribute is used to set the field name for the weight of data.

© 2017 KoolChart. All rights reserved.