From 88faa66292394978226b0e46dbdb91c58668e600 Mon Sep 17 00:00:00 2001 From: nikogu <644506165@qq.com> Date: Tue, 31 Oct 2017 14:15:44 +0800 Subject: [PATCH] fix tagCloud repain --- src/components/Charts/TagCloud/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Charts/TagCloud/index.js b/src/components/Charts/TagCloud/index.js index ee211c95..8ee3d3b0 100644 --- a/src/components/Charts/TagCloud/index.js +++ b/src/components/Charts/TagCloud/index.js @@ -73,7 +73,7 @@ class TagCloud extends PureComponent { this.node = node; } - @Debounce(300) + @Debounce(500) renderChart = (newData) => { const data = newData || this.props.data; if (!data || data.length < 1) { @@ -88,11 +88,6 @@ class TagCloud extends PureComponent { width = this.root.offsetWidth * 4; } - // clean - if (this.node) { - this.node.innerHTML = ''; - } - data.sort((a, b) => b.value - a.value); const max = data[0].value; @@ -114,6 +109,11 @@ class TagCloud extends PureComponent { }); layout.image(imgUrl, (imageCloud) => { + // clean + if (this.node) { + this.node.innerHTML = ''; + } + // 执行词云布局函数,并在回调函数中调用G2对结果进行绘制 imageCloud.exec((texts) => { const chart = new G2.Chart({ -- GitLab