🍩🎂 Checkpoint
./public/index.js:1954897/51592
This commit is contained in:
1 parent
7bf9644c09
commit
505066eaad
1 file changed
+16
-18
+16
-18
@@ -60,27 +60,25 @@ for (const [id, building] of Object.entries(buildings)) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
buildings[id].poly = poly
|
buildings[id].poly = poly
|
||||||
|
|
||||||
// if (id === "MC") {
|
|
||||||
// poly.setStyle({
|
|
||||||
// color: "#00e676",
|
|
||||||
// opacity: .5
|
|
||||||
// })
|
|
||||||
// } else if (id === "SU"){
|
|
||||||
// poly.setStyle({
|
|
||||||
// color: "yellow",
|
|
||||||
// opacity: .5
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const label = new L.marker(poly.getCenter(), { opacity: 0.00 }) //opacity may be set to zero
|
|
||||||
// label.bindTooltip(id, {permanent: true, className: "my-label", offset: [0, 0] });
|
|
||||||
// label.addTo(map)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch('/db.csv').then(res => res.text()).then(text => {
|
fetch('/db.csv').then(res => res.text()).then(text => {
|
||||||
const data = text.trim().split('\n').map(line => line.split(','))
|
const data = text.trim().split('\n').map(line => {
|
||||||
console.log(data)
|
const [loc, time, count] = line.split(',')
|
||||||
|
return { loc, time: new Date(+time), count: parseInt(count) }
|
||||||
|
})
|
||||||
|
|
||||||
|
const ecss = data.filter(d => d.loc === 'ecss')
|
||||||
|
|
||||||
|
console.log(ecss)
|
||||||
|
|
||||||
|
const avg = ecss.reduce((acc, v) => acc + v.count, 0) / ecss.length
|
||||||
|
const current = ecss[ecss.length - 1].count
|
||||||
|
const delta = current - avg
|
||||||
|
const color = delta > 0 ? '#ff0000' : '#00ff00'
|
||||||
|
buildings.ECSW.poly.setStyle({
|
||||||
|
color: `#${color}`
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
async function displayCard(id) {
|
async function displayCard(id) {
|
||||||
|
|||||||
Reference in new issue
Block a user