graphs: set x-axis using absolute time in advance()
setInterval() won't be reliably fired by the browser when the tab is backgrounded!
This commit is contained in:
@@ -200,8 +200,10 @@ function pruneGraphData(dataset, options) {
|
||||
}
|
||||
|
||||
function advance() {
|
||||
graph.options.scales.x.min += LIVE_REFRESH_INTERVAL_MSECS;
|
||||
graph.options.scales.x.max += LIVE_REFRESH_INTERVAL_MSECS;
|
||||
// advance is called in a timer and when the browser tab is in the background , it is unreliable. Use absolute time to set the scale
|
||||
const now = Date.now();
|
||||
graph.options.scales.x.min = now - 5*60*1000;
|
||||
graph.options.scales.x.max = now;
|
||||
graph.update('none');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user