ソースを参照

fix tagCloud repain

nikogu 8 年 前
コミット
88faa66292
1 ファイル変更6 行追加6 行削除
  1. 6 6
      src/components/Charts/TagCloud/index.js

+ 6 - 6
src/components/Charts/TagCloud/index.js

@@ -73,7 +73,7 @@ class TagCloud extends PureComponent {
     this.node = node;
     this.node = node;
   }
   }
 
 
-  @Debounce(300)
+  @Debounce(500)
   renderChart = (newData) => {
   renderChart = (newData) => {
     const data = newData || this.props.data;
     const data = newData || this.props.data;
     if (!data || data.length < 1) {
     if (!data || data.length < 1) {
@@ -88,11 +88,6 @@ class TagCloud extends PureComponent {
       width = this.root.offsetWidth * 4;
       width = this.root.offsetWidth * 4;
     }
     }
 
 
-    // clean
-    if (this.node) {
-      this.node.innerHTML = '';
-    }
-
     data.sort((a, b) => b.value - a.value);
     data.sort((a, b) => b.value - a.value);
 
 
     const max = data[0].value;
     const max = data[0].value;
@@ -114,6 +109,11 @@ class TagCloud extends PureComponent {
     });
     });
 
 
     layout.image(imgUrl, (imageCloud) => {
     layout.image(imgUrl, (imageCloud) => {
+      // clean
+      if (this.node) {
+        this.node.innerHTML = '';
+      }
+
       // 执行词云布局函数,并在回调函数中调用G2对结果进行绘制
       // 执行词云布局函数,并在回调函数中调用G2对结果进行绘制
       imageCloud.exec((texts) => {
       imageCloud.exec((texts) => {
         const chart = new G2.Chart({
         const chart = new G2.Chart({