javascript - 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
解决方案
无需完全重新创建图表来更新数据。此处的最佳做法是将新数据应用于现有图表。有关详细信息,请查看示例。
推荐阅读
- java - 无法通过 JDBC 禁用 Oracle 外键
- reactjs - 通过 reactjs 上传进度条文件的问题
- regex - Google 死亡测试预期中的匹配行号
- c# - 如何在不添加属性的情况下自定义 Json.net 中嵌套属性的反序列化
- sql - Rails sql内部联接:当只有1行匹配排除条件时,如何排除同一ID上的所有行?
- swift - 如何将数据从 NSTableCellView 传递到自定义 NSTableCellView
- c# - C# 作为 Win Service 在 Console.Title 上兑现
- java - 我的 Eclipse 崩溃了,现在它无法启动 java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
- r - 闪亮的仪表板在所有选项卡上都有重复元素
- r - 如何在 Rmarkdown github_document 中使用 MathJax?