|
@@ -539,7 +539,10 @@
|
|
function updateChart() {
|
|
function updateChart() {
|
|
//networkStatisticChart.data.datasets[0].data = rxValues;
|
|
//networkStatisticChart.data.datasets[0].data = rxValues;
|
|
//networkStatisticChart.data.datasets[1].data = txValues;
|
|
//networkStatisticChart.data.datasets[1].data = txValues;
|
|
- networkStatisticChart.update();
|
|
|
|
|
|
+ if (networkStatisticChart != undefined){
|
|
|
|
+ networkStatisticChart.update();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
function updateChartSize(){
|
|
function updateChartSize(){
|
|
@@ -549,11 +552,12 @@
|
|
}else{
|
|
}else{
|
|
newSize = $("#networkActWrapper").width() - 500;
|
|
newSize = $("#networkActWrapper").width() - 500;
|
|
}
|
|
}
|
|
- networkStatisticChart.resize(newSize, 200);
|
|
|
|
|
|
+ if (networkStatisticChart != undefined){
|
|
|
|
+ networkStatisticChart.resize(newSize, 200);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- var chartResizeTimeout;
|
|
|
|
- window.addEventListener('resize', () => {
|
|
|
|
|
|
+ function handleChartAccumulateResize(){
|
|
$("#networkActivity").hide();
|
|
$("#networkActivity").hide();
|
|
$("#networkActivityPlaceHolder").show();
|
|
$("#networkActivityPlaceHolder").show();
|
|
if (chartResizeTimeout != undefined){
|
|
if (chartResizeTimeout != undefined){
|
|
@@ -565,24 +569,30 @@
|
|
$("#networkActivity").show();
|
|
$("#networkActivity").show();
|
|
updateChartSize();
|
|
updateChartSize();
|
|
}, 300);
|
|
}, 300);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var chartResizeTimeout;
|
|
|
|
+ window.addEventListener('resize', () => {
|
|
|
|
+ handleChartAccumulateResize();
|
|
});
|
|
});
|
|
|
|
|
|
//Bind event to tab switch
|
|
//Bind event to tab switch
|
|
tabSwitchEventBind["status"] = function(){
|
|
tabSwitchEventBind["status"] = function(){
|
|
//On switch over to this page, resize the chart
|
|
//On switch over to this page, resize the chart
|
|
- $("#networkActivity").hide();
|
|
|
|
- $("#networkActivityPlaceHolder").show();
|
|
|
|
- if (chartResizeTimeout != undefined){
|
|
|
|
- clearTimeout(chartResizeTimeout);
|
|
|
|
- }
|
|
|
|
- chartResizeTimeout = setTimeout(function(){
|
|
|
|
- chartResizeTimeout = undefined;
|
|
|
|
- $("#networkActivityPlaceHolder").hide();
|
|
|
|
- $("#networkActivity").show();
|
|
|
|
|
|
+ $("#networkActivityPlaceHolder").hide();
|
|
|
|
+ $("#networkActivity").show().delay(100, function(){
|
|
updateChartSize();
|
|
updateChartSize();
|
|
- }, 300);
|
|
|
|
|
|
+ });
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ document.addEventListener("visibilitychange", () => {
|
|
|
|
+ // it could be either hidden or visible
|
|
|
|
+ //handleChartAccumulateResize();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
//Initialize chart data
|
|
//Initialize chart data
|
|
initChart();
|
|
initChart();
|
|
fetchData();
|
|
fetchData();
|