首页 > 解决方案 > JS function create multiple div when running with new data

问题描述

I am really new to HTML and working on this simple task for hours.

I have dynamic data that use it to create a word cloud, the problem is when data changes, my js function make a new div and therefore a new word cloud but I want to update the last one, something look dynamic.

here is my js code:

function foo(){
    <!--some other things-->
   anychart.onDocumentReady(function () {
   var chart = anychart.tagCloud(word_cloud);
   chart.title('Word relevancy map')
   chart.angles([0])
   chart.container("container");
   chart.draw();
    });
}

and my HTML container is like this:

<div id="container"  class="col-lg-8"  width=" 100%" height="800">

any help is appreciated<3

标签: javascripthtmlanychart

解决方案


无需完全重新创建图表来更新数据。此处的最佳做法是将新数据应用于现有图表。有关详细信息,请查看示例


推荐阅读