fix sparklines
Costa Tsaousis (ktsaou) committed
Nov 16, 2017 at 23:25 UTC
fdfa2befe21ca195773a9b893982788e5b729586
1 file changed
+8
-3
web/dashboard.js
+8
-3
@@ -5514,13 +5514,19 @@ var NETDATA = window.NETDATA || {};
5514
var v = state.legendFormatValue(y);
5515
var new_units = state.units_current;
5516
5517
- if(new_units !== old_units) {
5517
+ if(state.units_desired === 'auto' && typeof old_units !== 'undefined' && new_units !== old_units && !NETDATA.chartLibraries.dygraph.isSparkline(state)) {
5518
// console.log(this);
5519
// state.log('units discrepancy: old = ' + old_units + ', new = ' + new_units);
5520
var len = this.plugins_.length;
5521
while(len--) {
5522
// console.log(this.plugins_[len]);
5523
- if(typeof this.plugins_[len].plugin.ylabel_div_ !== 'undefined') {
5523
+ if(typeof this.plugins_[len].plugin.ylabel_div_ !== 'undefined'
5524
+ && this.plugins_[len].plugin.ylabel_div_ !== null
5525
+ && typeof this.plugins_[len].plugin.ylabel_div_.children !== 'undefined'
5526
+ && this.plugins_[len].plugin.ylabel_div_.children !== null
5527
+ && typeof this.plugins_[len].plugin.ylabel_div_.children[0].children !== 'undefined'
5528
+ && this.plugins_[len].plugin.ylabel_div_.children[0].children !== null
5529
+ ) {
5530
this.plugins_[len].plugin.ylabel_div_.children[0].children[0].innerHTML = new_units;
5531
this.user_attrs_.ylabel = new_units;
5532
break;
@@ -5529,7 +5535,6 @@ var NETDATA = window.NETDATA || {};
5535
5536
if(len < 0)
5537
state.log('units discrepancy, but cannot find dygraphs div to change: old = ' + old_units + ', new = ' + new_units);
5532
-
5538
}
5539
5540
return v;