mirror of
https://github.com/Roslund/sthlm-mesh.git
synced 2026-08-07 09:23:02 +02:00
deploy: 958a9516d0
This commit is contained in:
@@ -39,7 +39,10 @@ async function messagesStatsGraph() {
|
||||
autoSkip: false
|
||||
}
|
||||
},
|
||||
y: { beginAtZero: true }
|
||||
y: {
|
||||
beginAtZero: true,
|
||||
max: 10,
|
||||
}
|
||||
},
|
||||
plugins: { legend: { display: false } },
|
||||
}
|
||||
|
||||
@@ -44,7 +44,8 @@ async function mostActiveNodesGraph() {
|
||||
scales: {
|
||||
y: {
|
||||
ticks: { autoSkip: false, font: { size: 12 } }
|
||||
}
|
||||
},
|
||||
x: { max: 300 },
|
||||
},
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
async function portnumDistributionChart() {
|
||||
const canvas = document.getElementById('portnumDistribution');
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
// Loading message
|
||||
ctx.font = '16px Arial';
|
||||
ctx.fillStyle = 'gray';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText('Loading data...', canvas.width / 2, canvas.height / 2);
|
||||
|
||||
try {
|
||||
const response = await fetch('https://map.sthlm-mesh.se/api/v1/stats/portnum-counts');
|
||||
const data = await response.json();
|
||||
|
||||
const labels = data.map(entry => entry.label.replace(/_APP$/, ''));
|
||||
const counts = data.map(entry => entry.count);
|
||||
|
||||
// Optional: dynamically size the container
|
||||
const chartContainer = document.getElementById('portnumDistributionContainer');
|
||||
chartContainer.style.height = `${labels.length * 25}px`;
|
||||
|
||||
const backgroundColors = counts.map(count => {
|
||||
if (count < 500) return '#7EB26D'; // Green
|
||||
if (count < 2000) return '#EAB839'; // Yellow
|
||||
return '#BF1B00'; // Red
|
||||
});
|
||||
|
||||
new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Packages',
|
||||
data: counts,
|
||||
backgroundColor: backgroundColors,
|
||||
borderWidth: 1
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
indexAxis: 'y',
|
||||
scales: {
|
||||
y: {
|
||||
ticks: { autoSkip: false, font: { size: 12 } }
|
||||
},
|
||||
x: { beginAtZero: true },
|
||||
},
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error loading portnum data:', error);
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.fillStyle = 'red';
|
||||
ctx.fillText('Error loading data', canvas.width / 2, canvas.height / 2);
|
||||
}
|
||||
}
|
||||
|
||||
portnumDistributionChart();
|
||||
+1
-1
@@ -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/solar_nodes/</loc><lastmod>2025-02-25T20:03:55+01: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-03-28T17:26:53+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/meetups/</loc><lastmod>2025-03-03T22:48:04+01: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-03-31T21:50:55+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/</loc><lastmod>2025-03-29T13:59:58+01: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/solar_nodes/</loc><lastmod>2025-02-25T20:03:55+01: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-03-28T17:26:53+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/meetups/</loc><lastmod>2025-03-03T22:48:04+01: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-04-07T22:07:20+02:00</lastmod></url><url><loc>https://sthlm-mesh.se/</loc><lastmod>2025-03-29T13:59:58+01:00</lastmod></url><url><loc>https://sthlm-mesh.se/tags/</loc></url></urlset>
|
||||
+5
-4
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user