Browse Source

HUE-5540 [editor] Fix JS error on pivot chart

Enrico Berti 9 years ago
parent
commit
46edbcf
1 changed files with 17 additions and 0 deletions
  1. 17 0
      desktop/libs/notebook/src/notebook/templates/editor_components.mako

+ 17 - 0
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -2986,6 +2986,23 @@ ${ hueIcons.symbols() }
             });
           }
         });
+        // fills in missing values
+        var longestSerie = 0;
+        _datum.forEach(function (d) {
+          if (d.values.length > longestSerie) {
+            longestSerie = d.values.length;
+          }
+        });
+        _datum.forEach(function (d) {
+          if (d.values.length < longestSerie) {
+            var zeroObj = jQuery.extend({}, d.values[0]);
+            zeroObj.x = '';
+            zeroObj.y = 0;
+            for (var i = d.values.length; i < longestSerie; i++) {
+              d.values.push(zeroObj)
+            }
+          }
+        });
       }
       else {
         rawDatum.snippet.result.meta().forEach(function (meta) {