added timeout on updateAuto (zoomComplete) to prevent request stacking on mobile phones
This commit is contained in:
@ -292,6 +292,7 @@ let graphs = (function (){
|
||||
|
||||
let created = false;
|
||||
let activateUpdateTimeout = undefined;
|
||||
let updateAutoTimeout = undefined;
|
||||
|
||||
let container = document.createElement('div');
|
||||
container.classList.add("graphs-container");
|
||||
@ -1258,6 +1259,19 @@ let graphs = (function (){
|
||||
}
|
||||
}
|
||||
|
||||
function onZoomCompleteCallback(){
|
||||
if (updateAutoTimeout === undefined){
|
||||
updateAutoTimeout = setTimeout(function() {
|
||||
updateAuto();
|
||||
updateAutoTimeout = undefined;
|
||||
}, 100);
|
||||
}
|
||||
else{
|
||||
clearTimeout(updateAutoTimeout);
|
||||
updateAutoTimeout = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
addDataset: addDataset,
|
||||
//toggleAxesType: toggleAxesType,
|
||||
@ -1291,6 +1305,7 @@ let graphs = (function (){
|
||||
shiftNewer: shiftNewer,
|
||||
jumpToDate: jumpToDate,
|
||||
initGraphs: initGraphs,
|
||||
onZoomCompleteCallback:onZoomCompleteCallback,
|
||||
}
|
||||
})();
|
||||
|
||||
@ -1431,7 +1446,7 @@ function Graph(gindex, container, x_label, y_label, tag, scaleType = "linear"){
|
||||
sensitivity: 1,
|
||||
onZoom: function({chart}) { graphs.zoomCallback(chart.graph);},
|
||||
//onZoomComplete: function({chart}){graphs.checkReload(chart.graph);redraw()},
|
||||
onZoomComplete: function({chart}){graphs.updateAuto();},
|
||||
onZoomComplete: function({chart}){graphs.onZoomCompleteCallback()},
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user