Ver Fonte

HUE-5016 [charts] Skip negative values on Pie charts

Enrico Berti há 9 anos atrás
pai
commit
35d8638
1 ficheiros alterados com 6 adições e 0 exclusões
  1. 6 0
      desktop/core/src/desktop/static/desktop/js/ko.charts.js

+ 6 - 0
desktop/core/src/desktop/static/desktop/js/ko.charts.js

@@ -39,6 +39,9 @@
       window.setTimeout(function(){
         var _options = valueAccessor();
         var _data = _options.transformer(_options.data);
+        _data = _data.filter(function (val) {
+          return val.value >= 0;
+        });
         $(element).css("marginLeft", "auto");
         $(element).css("marginRight", "auto");
         if (typeof _options.maxWidth != "undefined") {
@@ -129,6 +132,9 @@
     update: function (element, valueAccessor) {
       var _options = valueAccessor();
       var _data = _options.transformer(_options.data);
+      _data = _data.filter(function (val) {
+        return val.value >= 0;
+      });
       var _chart = $(element).data("chart");
       if (_chart) {
         var _d3 = d3.select($(element).find("svg")[0]);