@cryptotaxi247 / netdata-1 / commits / 83ff57bdb

fixed iteraction between charts

Costa Tsaousis (ktsaou) committed Dec 6, 2015 at 16:07 UTC 83ff57bdb5e07a643e0368674f23155b670cf22a
1 file changed +15 -9
web/dashboard.js
+15 -9
@@ -82,7 +82,7 @@
82 height: '100%', // the chart height
83 min_width: 240, //
84 library: 'dygraph', // the graphing library to use
85 - method: 'max', // the grouping method
85 + method: 'average', // the grouping method
86 before: 0, // panning
87 after: -600, // panning
88 pixels_per_point: 1 // the detail of the chart
@@ -416,7 +416,7 @@
416 this.enabled = true;
417 this.debug = false;
418
419 - state.updateChart();
419 + // state.updateChart();
420 },
421
422 setMode: function(m) {
@@ -697,8 +697,16 @@
697 if(NETDATA.options.debug.chart_data_url) this.log('chartURL(): ' + this.mode.url + ' WxH:' + this.calculated_width + 'x' + this.calculated_height + ' points: ' + this.mode.points + ' library: ' + this.library_name);
698 },
699
700 - canBeAutoRefreshed: function(auto_refresher) {
701 - if(this.mode.autorefresh) {
700 + isVisible: function() {
701 + return self.visible(true);
702 + },
703 +
704 + isAutoRefreshed: function() {
705 + return this.mode.autorefresh;
706 + },
707 +
708 + canBeAutoRefreshed: function() {
709 + if(this.isAutoRefreshed()) {
710 var now = new Date().getTime();
711
712 if(this.updates_counter && !NETDATA.options.page_is_visible) {
@@ -706,9 +714,7 @@
714 return false;
715 }
716
709 - if(!auto_refresher) return true;
710 -
711 - if(!self.visible(true)) {
717 + if(!this.isVisible()) {
718 if(this.debug) this.log('canBeAutoRefreshed(): I am not visible.');
719 return false;
720 }
@@ -747,7 +753,7 @@
753 },
754
755 autoRefresh: function(callback) {
750 - if(this.canBeAutoRefreshed(true))
756 + if(this.canBeAutoRefreshed())
757 this.updateChart(callback);
758 else if(typeof callback != 'undefined')
759 callback();
@@ -1257,7 +1263,7 @@
1263 if(state.debug) st.log('sync: not adding me to sync');
1264 }
1265 else {
1260 - if(typeof st.dygraph_instance == 'object' && st.library_name == state.library_name && st.canBeAutoRefreshed(false)) {
1266 + if(typeof st.dygraph_instance == 'object' && st.library_name == state.library_name && st.isVisible()) {
1267 NETDATA.dygraph.slaves.push(st);
1268 if(state.debug) st.log('sync: added slave to sync');
1269 }