]> arthur.barton.de Git - netdata.git/blobdiff - web/dashboard.js
Merge branch 'master' into ab-debian
[netdata.git] / web / dashboard.js
index a462f10faf63be6486cbac07b569090e9c6dc211..b34accdecb0948a45a1769631e1f2d5a02681b8a 100644 (file)
@@ -130,7 +130,7 @@ var NETDATA = window.NETDATA || {};
     NETDATA.peity_js            = NETDATA.serverDefault + 'lib/jquery.peity-3.2.0.min.js';
     NETDATA.sparkline_js        = NETDATA.serverDefault + 'lib/jquery.sparkline-2.1.2.min.js';
     NETDATA.easypiechart_js     = NETDATA.serverDefault + 'lib/jquery.easypiechart-97b5824.min.js';
-    NETDATA.gauge_js            = NETDATA.serverDefault + 'lib/gauge-1.3.1.min.js';
+    NETDATA.gauge_js            = NETDATA.serverDefault + 'lib/gauge-1.3.2.min.js';
     NETDATA.dygraph_js          = NETDATA.serverDefault + 'lib/dygraph-combined-dd74404.js';
     NETDATA.dygraph_smooth_js   = NETDATA.serverDefault + 'lib/dygraph-smooth-plotter-dd74404.js';
     NETDATA.raphael_js          = NETDATA.serverDefault + 'lib/raphael-2.2.4-min.js';
@@ -2252,13 +2252,16 @@ var NETDATA = window.NETDATA || {};
             if(min === __legendFormatValueChartDecimalsLastMin && max === __legendFormatValueChartDecimalsLastMax)
                 return;
 
-            if(this.value_decimal_detail !== -1) {
+            __legendFormatValueChartDecimalsLastMin = min;
+            __legendFormatValueChartDecimalsLastMax = max;
+
+            if(this.data !== null && this.data.min === this.data.max)
+                __legendFormatValueChartDecimals = -1;
+
+            else if(this.value_decimal_detail !== -1)
                 __legendFormatValueChartDecimals = this.value_decimal_detail;
-            }
-            else {
-                __legendFormatValueChartDecimalsLastMin = min;
-                __legendFormatValueChartDecimalsLastMax = max;
 
+            else {
                 var delta;
 
                 if (min === max)
@@ -2269,7 +2272,7 @@ var NETDATA = window.NETDATA || {};
                 if (delta > 1000)     __legendFormatValueChartDecimals = 0;
                 else if (delta > 10)  __legendFormatValueChartDecimals = 1;
                 else if (delta > 1)   __legendFormatValueChartDecimals = 2;
-                else if (delta > 0.1) __legendFormatValueChartDecimals = 3;
+                else if (delta > 0.1) __legendFormatValueChartDecimals = 2;
                 else                  __legendFormatValueChartDecimals = 4;
             }
         };
@@ -2285,7 +2288,7 @@ var NETDATA = window.NETDATA || {};
                 if(abs > 1000)      dmax = 0;
                 else if(abs > 10 )  dmax = 1;
                 else if(abs > 1)    dmax = 2;
-                else if(abs > 0.1)  dmax = 3;
+                else if(abs > 0.1)  dmax = 2;
                 else                dmax = 4;
             }
             else {
@@ -3136,7 +3139,8 @@ var NETDATA = window.NETDATA || {};
                 if(this.debug === true)
                     this.log('max updates of ' + this.updates_since_last_creation.toString() + ' reached. Forcing re-generation.');
 
-                this.chart_created = false;
+                init();
+                return;
             }
 
             // check and update the legend
@@ -4257,12 +4261,6 @@ var NETDATA = window.NETDATA || {};
             dygraph.updateOptions(options);
         }
 
-        // decide the decimal points on the legend of the chart
-        state.legendFormatValueDecimalsFromMinMax(
-            state.dygraph_instance.axes_[0].extremeRange[0],
-            state.dygraph_instance.axes_[0].extremeRange[1]
-        );
-
         state.dygraph_last_rendered = Date.now();
         return true;
     };
@@ -4865,12 +4863,6 @@ var NETDATA = window.NETDATA || {};
             state.__commonMax = null;
         }
 
-        // decide the decimal points on the legend of the chart
-        state.legendFormatValueDecimalsFromMinMax(
-            state.dygraph_instance.axes_[0].extremeRange[0],
-            state.dygraph_instance.axes_[0].extremeRange[1]
-        );
-
         return true;
     };
 
@@ -5797,7 +5789,7 @@ var NETDATA = window.NETDATA || {};
             var len = generateGradient.length;
             while(len--) {
                 var pcent = generateGradient[len];
-                var color = self.data('gauge-gradient-percent-color-' + pcent.toString()) || false;
+                var color = self.attr('data-gauge-gradient-percent-color-' + pcent.toString()) || false;
                 if(color !== false) {
                     var a = [];
                     a[0] = pcent / 100;