*** WIP WIP *** same more changes !

This commit is contained in:
rxf
2023-03-17 17:38:19 +01:00
parent 0a89e05329
commit 586b2641e2
6 changed files with 62 additions and 6 deletions
+38 -4
View File
@@ -154,7 +154,7 @@ function getMedian(markers) {
console.log(markers);
let i = 0; // now find the 'offlines' (value == -1)
for (i = 0; i < markers.length; i++) {
if (markers[i].options.value != -1) {
if (markers[i].options.value > 0) {
break;
}
}
@@ -196,7 +196,7 @@ function buildIcon(color, n, indoor) {
'y="400" font-size="1500%" font-family="Verdana,Lucida Sans Unicode,sans-serif" ' +
'fill="' + txtColor + '">' + n + '</text>';
}
if(indoor !== 0) {
if(indoor) {
circIcon += '<line x1="125" y1="475" x2="475" y2="125" stroke="black" stroke-width="20" />'
}
circIcon += '</svg>';
@@ -242,7 +242,7 @@ export async function buildMarkers() {
name: x.id,
value: x.value,
url: '/graph?sid=' + x.id,
lastseen: dt.formatJSDate(x.lastseen),
lastseen: dt.formatISODate(x.lastseen),
indoor: x.indoor
})
.on('click', e => onMarkerClick(e, true)) // define click- and
@@ -273,7 +273,7 @@ async function onMarkerClick(e, click) {
${item.value < 0 ? offlinetext : normaltext}
</table>
<div id="infoBtn">
<a href="#" class="speciallink">Grafik anzeigen</a>
<a href="#" class="speciallink">Show chart</a>
</div>
</div>
</div>`
@@ -298,3 +298,37 @@ async function setCenter(adr) {
map.setView([parseFloat(data.lat), parseFloat(data.lon)]);
console.log(data);
}
/*
// Show the last date below tha map grafics
async function showLastDate(dt) {
const url = `http://localhost:3004/getproperties?type=noise&box=${bounds.toBBoxString()}`
let ret = await fetch(url)
.catch(e => {
console.log(e)
});
let sensors = await ret.json()
let url = '/api/getdata';
let ld = moment(dt);
let last = ld.subtract(1,'h')
let erg;
let allsens
try {
erg = await $.getJSON(url + `?data=props&last=1900-01-01`);
allsens = erg.count
erg = await $.getJSON(url + `?data=props&last=${last.format('YYYY-MM-DD HH:mm')}`);
if ((erg != undefined) && (erg.values[0].error != undefined)) {
showError(3,erg.values[0].error,aktsensorid);
return;
}
}
catch(e) {
console.log(e)
}
$('#mapdate').html('Werte von ' + ld.format('YYYY-MM-DD HH:mm'));
$('#actsensors').html(`${erg.count} aktive Sensoren (angemeldet ${allsens})`)
}
*/