fix missing graphData culling behavior

This commit is contained in:
Nick Krecklow 2020-05-12 22:10:38 -05:00
parent 7fd0117f74
commit a68e4d2460
No known key found for this signature in database
GPG Key ID: 5F149FDE156FFA94
2 changed files with 16 additions and 1 deletions

View File

@ -35,6 +35,21 @@ export class GraphDisplayManager {
this._graphData[i].push(playerCounts[i])
}
// Trim all data arrays to only the relevant portion
// This keeps it in sync with backend data structures
const graphMaxLength = this._app.publicConfig.graphMaxLength
if (this._graphTimestamps.length > graphMaxLength) {
this._graphTimestamps.splice(0, this._graphTimestamps.length - graphMaxLength)
}
for (const series of this._graphData) {
if (series.length > graphMaxLength) {
series.splice(0, series.length - graphMaxLength)
}
}
// Paint updated data structure
this._plotInstance.setData([
this._graphTimestamps,
...this._graphData

View File

@ -58,7 +58,7 @@ class TimeTracker {
}
static getMaxGraphDataLength () {
return Math.ceil(config.graphDuration / config.rates.pingAll)
return Math.ceil(config.graphDuration / GRAPH_UPDATE_TIME_GAP)
}
static everyN (array, start, diff, adapter) {