📷🏈 Checkpoint

./public/index.js:1954897/48442
This commit is contained in:
Glitch (glitch-hello-node) committed 2021-11-14 07:58:25 +00:00
1 parent 94fc5d39b6
commit 6598bcd297
2 files changed
+31 -5

No files matched your search

+6 -5
View File
@@ -134,7 +134,7 @@ async function displayCard(id) {
function updateChart(data) {
const parsed = data.map(d => {
const TEN_MINUTES = 2 * 60 * 1000
const TEN_MINUTES = 1 * 60 * 1000
// this is 0-5
let ago = Math.floor((Date.now() - d.time) / TEN_MINUTES)
// if (20 < ago) ago = 20
@@ -147,16 +147,17 @@ function updateChart(data) {
return acc
}, []).map(v => v.reduce((acc, v) => acc + v, 0) / v.length)
console.log(parsed)
const ctx = document.getElementById('myChart').getContext('2d')
const labels = ['Now', '10m ago', '20m ago', '30m ago', '40m ago', '50m ago'].reverse()
console.log(parsed.slice(0, labels.length))
new Chart(ctx, {
type: 'line',
data: {
labels: ['Now', '10m ago', '20m ago', '30m ago', '40m ago', '50m ago'].reverse(),
labels,
datasets: [{
label: 'Density',
data: parsed.reverse(),
data: parsed.slice(0, labels.length).reverse(),
borderColor: '#55aadd',
backgroundColor: '#55aadd',
// borderWidth: 2