diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-01-30 23:33:10 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2018-01-30 23:33:10 +0200 |
commit | 59b68d5108bdbbaedf637f0ac1796ad9e5e69bc0 (patch) | |
tree | 640bdc357e84e9c9af8df51debbd1ad53444de9e /web | |
parent | 57d342f17eee71c47066fc61c3179dd9d9c267a0 (diff) |
optimize d3pie for speed
Diffstat (limited to 'web')
-rw-r--r-- | web/dashboard.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/web/dashboard.js b/web/dashboard.js index 039e3259e9..2d44f988d6 100644 --- a/web/dashboard.js +++ b/web/dashboard.js @@ -7303,6 +7303,7 @@ var NETDATA = window.NETDATA || {}; color: '#666666' }); + state.tmp.d3pie_last_slot = 0; return content; }; @@ -7334,6 +7335,11 @@ var NETDATA = window.NETDATA || {}; if(slot < 0 || slot >= state.data.result.length) return NETDATA.d3pieClearSelection(state, true); + if(state.tmp.d3pie_last_slot === slot) { + // we already show this slot, don't do anything + return true; + } + if(state.tmp.d3pie_timer === undefined) { state.tmp.d3pie_timer = NETDATA.timeout.set(function() { state.tmp.d3pie_timer = undefined; @@ -7354,7 +7360,10 @@ var NETDATA = window.NETDATA || {}; NETDATA.d3pieChartUpdate(state, state.data); } else { - NETDATA.d3pieChange(state, [ { label: 'no data', value: 1, color: '#666666' } ], 'no data available'); + if(state.tmp.d3pie_last_slot !== -1) { + state.tmp.d3pie_last_slot = -1; + NETDATA.d3pieChange(state, [{label: 'no data', value: 1, color: '#666666'}], 'no data available'); + } } return true; |