浏览代码

HUE-6093 [frontend] Improved timeout mechanism for Pie charts

Enrico Berti 8 年之前
父节点
当前提交
b7985ba
共有 1 个文件被更改,包括 5 次插入5 次删除
  1. 5 5
      desktop/core/src/desktop/static/desktop/js/ko.charts.plotly.js

+ 5 - 5
desktop/core/src/desktop/static/desktop/js/ko.charts.plotly.js

@@ -49,16 +49,16 @@
       });
       });
     },
     },
     update: function (element, valueAccessor) {
     update: function (element, valueAccessor) {
-      var _options = valueAccessor();
-      var plotterTimeout = window.setTimeout(function () {
-        window.clearTimeout(plotterTimeout);
-        var _data = _options.transformer(_options.data);
+      var options = valueAccessor();
+      window.clearTimeout(element.plotterTimeout);
+      element.plotterTimeout = window.setTimeout(function () {
+        var data = options.transformer(options.data);
         var chartData = {
         var chartData = {
           values: [],
           values: [],
           labels: [],
           labels: [],
           type: 'pie'
           type: 'pie'
         }
         }
-        _data.forEach(function (el) {
+        data.forEach(function (el) {
           chartData.values.push(el.value);
           chartData.values.push(el.value);
           chartData.labels.push(el.label);
           chartData.labels.push(el.label);
         });
         });