-
This chart shows a bell curve (normal distribution) based on the total "Times Seen" values for all nodes. It helps visualize how frequently nodes are heard, relative to the average.
-
This "Times Seen" value is the closest that we can get to Mesh utilization by node.
-
Mean: - Standard Deviation:
+
+ This chart shows a bell curve (normal distribution) based on the total "Times Seen" values for all nodes. It helps visualize how frequently nodes are heard, relative to the average.
+
+
+ This "Times Seen" value is the closest that we can get to Mesh utilization by node.
+
+
+ Mean: -
+ Standard Deviation:
+
@@ -97,23 +104,23 @@ select {
{% if nodes %}
- No top traffic nodes available.
+No top traffic nodes available.
{% endif %}
@@ -121,31 +128,45 @@ select {
const nodes = {{ nodes | tojson }};
let filteredNodes = [];
-// Chart & Stats
+// --- Language support ---
+async function loadTopTranslations() {
+ const langCode = "{{ site_config.get('site', {}).get('language','en') }}";
+ try {
+ const res = await fetch(`/api/lang?lang=${langCode}§ion=top`);
+ window.topTranslations = await res.json();
+ } catch(err) {
+ console.error("Top page translation load failed:", err);
+ window.topTranslations = {};
+ }
+}
+
+function applyTopTranslations() {
+ const t = window.topTranslations || {};
+ document.querySelectorAll("[data-translate-lang]").forEach(el=>{
+ const key = el.getAttribute("data-translate-lang");
+ if(t[key]) el.textContent = t[key];
+ });
+}
+
+// --- Chart & Table code ---
const chart = echarts.init(document.getElementById('bellCurveChart'));
const meanEl = document.getElementById('mean');
const stdEl = document.getElementById('stdDev');
-// Populate Channel Dropdown (without "All"), default to "LongFast"
+// Populate channel dropdown
const channelSet = new Set();
nodes.forEach(n => channelSet.add(n.channel));
const dropdown = document.getElementById('channelFilter');
-const sortedChannels = [...channelSet].sort();
-
-sortedChannels.forEach(channel => {
+[...channelSet].sort().forEach(channel => {
const option = document.createElement('option');
option.value = channel;
option.textContent = channel;
- if (channel === "LongFast") {
- option.selected = true;
- }
+ if (channel === "LongFast") option.selected = true;
dropdown.appendChild(option);
});
-// Default to LongFast filter on load
+// Filter default
filteredNodes = nodes.filter(n => n.channel === "LongFast");
-
-// Filter change handler
dropdown.addEventListener('change', () => {
const val = dropdown.value;
filteredNodes = nodes.filter(n => n.channel === val);
@@ -153,18 +174,16 @@ dropdown.addEventListener('change', () => {
updateStatsAndChart();
});
-// Normal distribution function
+// Normal distribution
function normalDistribution(x, mean, stdDev) {
- return (1 / (stdDev * Math.sqrt(2 * Math.PI))) * Math.exp(-0.5 * Math.pow((x - mean) / stdDev, 2));
+ return (1 / (stdDev * Math.sqrt(2 * Math.PI))) * Math.exp(-0.5 * Math.pow((x - mean) / stdDev, 2));
}
-// Update table based on filteredNodes
+// Update table
function updateTable() {
const tbody = document.querySelector('#trafficTable tbody');
tbody.innerHTML = "";
-
const mean = filteredNodes.reduce((sum, n) => sum + n.total_times_seen, 0) / (filteredNodes.length || 1);
-
for (const node of filteredNodes) {
const percent = mean > 0 ? ((node.total_times_seen / mean) * 100).toFixed(1) + "%" : "0%";
const row = `