clear gauges and easypiecharts on hover when no data are available
Costa Tsaousis (ktsaou) committed
Dec 24, 2017 at 16:13 UTC
deda69b824767e047656d8657322e106dfbdf4b8
1 file changed
+17
-20
web/dashboard.js
+17
-20
@@ -7017,16 +7017,13 @@ var NETDATA = window.NETDATA || {};
7017
}
7018
};
7019
7020
- NETDATA.easypiechartClearSelection = function(state) {
7021
- if(typeof state.tmp.easyPieChartEvent !== 'undefined') {
7022
- if(state.tmp.easyPieChartEvent.timer) {
7023
- NETDATA.timeout.clear(state.tmp.easyPieChartEvent.timer);
7024
- }
7025
-
7020
+ NETDATA.easypiechartClearSelection = function(state, force) {
7021
+ if(typeof state.tmp.easyPieChartEvent !== 'undefined' && typeof state.tmp.easyPieChartEvent.timer !== 'undefined') {
7022
+ NETDATA.timeout.clear(state.tmp.easyPieChartEvent.timer);
7023
state.tmp.easyPieChartEvent.timer = undefined;
7024
}
7025
7029
- if(state.isAutoRefreshable() === true && state.data !== null) {
7026
+ if(state.isAutoRefreshable() === true && state.data !== null && force !== true) {
7027
NETDATA.easypiechartChartUpdate(state, state.data);
7028
}
7029
else {
@@ -7040,11 +7037,11 @@ var NETDATA = window.NETDATA || {};
7037
7038
NETDATA.easypiechartSetSelection = function(state, t) {
7039
if(state.timeIsVisible(t) !== true)
7043
- return NETDATA.easypiechartClearSelection(state);
7040
+ return NETDATA.easypiechartClearSelection(state, true);
7041
7042
var slot = state.calculateRowForTime(t);
7043
if(slot < 0 || slot >= state.data.result.length)
7047
- return NETDATA.easypiechartClearSelection(state);
7044
+ return NETDATA.easypiechartClearSelection(state, true);
7045
7046
if(typeof state.tmp.easyPieChartEvent === 'undefined') {
7047
state.tmp.easyPieChartEvent = {
@@ -7186,8 +7183,10 @@ var NETDATA = window.NETDATA || {};
7183
if(animate === false) state.tmp.easyPieChart_instance.enableAnimation();
7184
7185
state.legendSetUnitsString = function(units) {
7189
- if(typeof state.tmp.easyPieChartUnits !== 'undefined')
7186
+ if(typeof state.tmp.easyPieChartUnits !== 'undefined' && state.tmp.units !== units) {
7187
state.tmp.easyPieChartUnits.innerText = units;
7188
+ state.tmp.units = units;
7189
+ }
7190
};
7191
state.legendShowUndefined = function() {
7192
if(typeof state.tmp.easyPieChart_instance !== 'undefined')
@@ -7294,16 +7293,13 @@ var NETDATA = window.NETDATA || {};
7293
}
7294
};
7295
7297
- NETDATA.gaugeClearSelection = function(state) {
7298
- if(typeof state.tmp.gaugeEvent !== 'undefined') {
7299
- if(state.tmp.gaugeEvent.timer) {
7300
- NETDATA.timeout.clear(state.tmp.gaugeEvent.timer);
7301
- }
7302
-
7296
+ NETDATA.gaugeClearSelection = function(state, force) {
7297
+ if(typeof state.tmp.gaugeEvent !== 'undefined' && typeof state.tmp.gaugeEvent.timer !== 'undefined') {
7298
+ NETDATA.timeout.clear(state.tmp.gaugeEvent.timer);
7299
state.tmp.gaugeEvent.timer = undefined;
7300
}
7301
7306
- if(state.isAutoRefreshable() === true && state.data !== null) {
7302
+ if(state.isAutoRefreshable() === true && state.data !== null && force !== true) {
7303
NETDATA.gaugeChartUpdate(state, state.data);
7304
}
7305
else {
@@ -7318,11 +7314,11 @@ var NETDATA = window.NETDATA || {};
7314
7315
NETDATA.gaugeSetSelection = function(state, t) {
7316
if(state.timeIsVisible(t) !== true)
7321
- return NETDATA.gaugeClearSelection(state);
7317
+ return NETDATA.gaugeClearSelection(state, true);
7318
7319
var slot = state.calculateRowForTime(t);
7320
if(slot < 0 || slot >= state.data.result.length)
7325
- return NETDATA.gaugeClearSelection(state);
7321
+ return NETDATA.gaugeClearSelection(state, true);
7322
7323
if(typeof state.tmp.gaugeEvent === 'undefined') {
7324
state.tmp.gaugeEvent = {
@@ -7556,11 +7552,12 @@ var NETDATA = window.NETDATA || {};
7552
NETDATA.gaugeAnimation(state, true);
7553
7554
state.legendSetUnitsString = function(units) {
7559
- if(typeof state.tmp.gaugeChartUnits !== 'undefined') {
7555
+ if(typeof state.tmp.gaugeChartUnits !== 'undefined' && state.tmp.units !== units) {
7556
state.tmp.gaugeChartUnits.innerText = units;
7557
state.tmp.___gaugeOld__.valueLabel = null;
7558
state.tmp.___gaugeOld__.minLabel = null;
7559
state.tmp.___gaugeOld__.maxLabel = null;
7560
+ state.tmp.units = units;
7561
}
7562
};
7563
state.legendShowUndefined = function() {