IoT - Kubus
/
Kubus
JNP3 16/17
Diff: frontend/kubus.js
- Revision:
- 24:a929fcdb1208
- Parent:
- 23:e643afa16ad1
- Child:
- 25:4fd33808f095
diff -r e643afa16ad1 -r a929fcdb1208 frontend/kubus.js --- a/frontend/kubus.js Mon Jan 09 19:14:08 2017 +0100 +++ b/frontend/kubus.js Mon Jan 09 19:24:43 2017 +0100 @@ -3,6 +3,7 @@ Chart.defaults.global.defaultFontColor = "#efefef"; const UPDATE_INTERVAL_SECONDS = 5; +const KEEP_DATA_POINTS = 10; class Charts { constructor(containerId) { @@ -78,7 +79,7 @@ this.chart.data.datasets[0].data.push(dataPoint); this.dataSize++; - if (this.dataSize > 10) { + if (this.dataSize > KEEP_DATA_POINTS) { this.chart.data.datasets[0].data.shift(); this.dataSize--; }