This commit is contained in:
Roslund
2025-08-09 10:21:37 +00:00
parent 6e9d14b999
commit ee6642ad75
23 changed files with 189 additions and 24 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+80
View File
@@ -0,0 +1,80 @@
async function isOkToMqttGraph() {
const canvas = document.getElementById('isOkToMqttChart');
const ctx = canvas.getContext('2d');
// Show "Loading..." message
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.font = '16px Arial';
ctx.fillStyle = 'gray';
ctx.textAlign = 'center';
ctx.fillText('Loading data...', canvas.width / 2, canvas.height / 2);
try {
await fetchNodes();
// Filter nodes to only include those updated within the last 30 days
const recentNodes = nodes.filter(node => new Date(node.updated_at) >= new Date(Date.now() - 30 * 24 * 60 * 60 * 1000));
let countTrue = 0;
let countFalse = 0;
let countNull = 0;
for (const node of recentNodes) {
const val = node.ok_to_mqtt;
if (val === true) countTrue++;
else if (val === false) countFalse++;
else countNull++;
}
const container = canvas.parentElement;
if (container) container.style.height = `${2 * 35 + 50}px`;
ctx.clearRect(0, 0, canvas.width, canvas.height);
new Chart(ctx, {
type: 'bar',
data: {
labels: ['True', 'False'],
datasets: [
{
label: 'true',
data: [countTrue, 0,],
backgroundColor: '#7EB26D', // blue
},
{
label: 'false',
data: [0, countFalse],
backgroundColor: '#BF1B00', // green
},
{
label: 'unset',
data: [0, countNull],
backgroundColor: '#808080', // grey
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
indexAxis: 'y',
plugins: {
legend: { display: false }
},
scales: {
x: { beginAtZero: true, stacked: true },
y: { stacked: true }
}
}
});
} catch (error) {
console.error('Error building ok_to_mqtt chart:', error);
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = 'red';
ctx.fillText('Error loading data', canvas.width / 2, canvas.height / 2);
}
}
isOkToMqttGraph();
+84
View File
@@ -0,0 +1,84 @@
async function isUnmessagableGraph() {
const canvas = document.getElementById('isUnmessagableChart');
const ctx = canvas.getContext('2d');
// Show "Loading..." message
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.font = '16px Arial';
ctx.fillStyle = 'gray';
ctx.textAlign = 'center';
ctx.fillText('Loading data...', canvas.width / 2, canvas.height / 2);
try {
await fetchNodes();
// Filter nodes to only include those updated within the last 30 days
const recentNodes = nodes.filter(node => new Date(node.updated_at) >= new Date(Date.now() - 30 * 24 * 60 * 60 * 1000));
let countTrue = 0;
let countFalse = 0;
let countNull = 0;
for (const node of recentNodes) {
const val = node.is_unmessagable;
if (val === true) countTrue++;
else if (val === false) countFalse++;
else countNull++;
}
const container = canvas.parentElement;
if (container) container.style.height = `${2 * 35 + 50}px`;
ctx.clearRect(0, 0, canvas.width, canvas.height);
new Chart(ctx, {
type: 'bar',
data: {
labels: ['unmessagable', 'messagable'],
datasets: [
{
label: 'true',
data: [countTrue, 0,],
backgroundColor: '#0d6efd', // blue
},
{
label: 'false',
data: [0, countFalse],
backgroundColor: '#7EB26D', // green
},
{
label: 'unset',
data: [0, countNull],
backgroundColor: '#808080', // grey
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
indexAxis: 'y',
plugins: {
legend: { display: false }
},
scales: {
x: {
beginAtZero: true,
stacked: true,
},
y: {
stacked: true,
}
}
}
});
} catch (error) {
console.error('Error building is_unmessagable chart:', error);
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = 'red';
ctx.fillText('Error loading data', canvas.width / 2, canvas.height / 2);
}
}
isUnmessagableGraph();
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://sthlm-mesh.se/docs/settings/</loc><lastmod>2025-02-26T18:39:36+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/device_role/</loc><lastmod>2025-02-26T18:42:15+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/position/</loc><lastmod>2025-02-22T09:11:26+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/mqtt/</loc><lastmod>2025-03-31T19:16:34+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/neighbor_info/</loc><lastmod>2025-02-23T20:48:06+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/kartor/</loc><lastmod>2025-03-08T20:11:28+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/hardware/</loc><lastmod>2025-04-21T12:00:04+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/solar_nodes/</loc><lastmod>2025-04-21T01:54:22+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/communities/</loc><lastmod>2025-02-23T20:48:06+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/categories/</loc></url><url><loc>https://sthlm-mesh.se/docs/</loc><lastmod>2025-03-03T22:48:04+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/messages/</loc><lastmod>2025-07-13T10:01:31+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/meetups/</loc><lastmod>2025-04-10T07:31:33+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/about/</loc><lastmod>2025-02-23T18:02:23+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/status/</loc><lastmod>2025-08-06T22:34:49+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/</loc><lastmod>2025-06-10T01:31:45+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/tags/</loc></url></urlset>
<?xml version="1.0" encoding="utf-8" standalone="yes"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"><url><loc>https://sthlm-mesh.se/docs/settings/</loc><lastmod>2025-02-26T18:39:36+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/device_role/</loc><lastmod>2025-02-26T18:42:15+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/position/</loc><lastmod>2025-02-22T09:11:26+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/mqtt/</loc><lastmod>2025-03-31T19:16:34+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/neighbor_info/</loc><lastmod>2025-02-23T20:48:06+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/kartor/</loc><lastmod>2025-03-08T20:11:28+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/hardware/</loc><lastmod>2025-04-21T12:00:04+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/solar_nodes/</loc><lastmod>2025-04-21T01:54:22+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/docs/communities/</loc><lastmod>2025-02-23T20:48:06+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/categories/</loc></url><url><loc>https://sthlm-mesh.se/docs/</loc><lastmod>2025-03-03T22:48:04+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/messages/</loc><lastmod>2025-07-13T10:01:31+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/meetups/</loc><lastmod>2025-04-10T07:31:33+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/about/</loc><lastmod>2025-02-23T18:02:23+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/status/</loc><lastmod>2025-08-09T12:20:54+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/</loc><lastmod>2025-06-10T01:31:45+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/tags/</loc></url></urlset>
+5 -4
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long