1 id + locks + live : more frequent, last known points, already sent points + ms points + fixed jump time

This commit is contained in:
l_samenv
2024-08-16 09:55:30 +02:00
parent f4cf8fd9a5
commit 9e08f47916
5 changed files with 83 additions and 73 deletions

View File

@ -291,6 +291,7 @@ let graphs = (function (){
let resolution = undefined;
let created = false;
let activateUpdateTimeout = undefined;
let container = document.createElement('div');
container.classList.add("graphs-container");
@ -452,6 +453,14 @@ let graphs = (function (){
showLegends(legendFlag, false);
if (legendFlag) adjustLegends();
if (activateUpdateTimeout !== undefined){
clearTimeout(activateUpdateTimeout)
}
activateUpdateTimeout = setTimeout(function(){
activateUpdates();
}, 1000);
// Was here before
// result = AJAX( "http://" + hostPort +
// "/updategraph?variables=" + variables() +
@ -662,6 +671,7 @@ let graphs = (function (){
}
}
console.log("RELOAD")
activateUpdates();
// Was here before
// AJAX( "http://" + hostPort + "/updategraph?id=" + clientID).getJSON(); // activate updates
// result = AJAX("http://" + hostPort +
@ -796,11 +806,11 @@ let graphs = (function (){
}
/**
* Sets the resolution of the viewing window in seconds
* Sets the resolution of the viewing window in milliseconds
* @param {*} timeDelta - The difference between the maximum time and the minimum time of the window
*/
function setResolution(timeDelta){
resolution = Math.ceil((timeDelta / container.getBoundingClientRect().width)/1000)
resolution = Math.ceil((timeDelta / container.getBoundingClientRect().width))
}
function jumpToDate(dateTimestampMs, timeValueMs, mode){
@ -938,7 +948,6 @@ let graphs = (function (){
ngraphs = 0;
createGraphs();
globalIndicators.getIndicatorsMap()[datesKey].update(currentMinTime);
activateUpdates();
});
}
@ -1037,7 +1046,6 @@ let graphs = (function (){
createGraphs();
activateUpdates();
});
}