mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Changed so that the Top page starts with long fast selected
This commit is contained in:
@@ -84,9 +84,7 @@ select {
|
||||
<h1>Top Traffic Nodes (last 24 hours)</h1>
|
||||
|
||||
<!-- Channel Filter Dropdown -->
|
||||
<select id="channelFilter">
|
||||
<option value="all">All Channels</option>
|
||||
</select>
|
||||
<select id="channelFilter"></select>
|
||||
|
||||
<div id="stats">
|
||||
<p>This chart shows a bell curve (normal distribution) based on the total <strong>"Times Seen"</strong> values for all nodes. It helps visualize how frequently nodes are heard, relative to the average.</p>
|
||||
@@ -94,7 +92,6 @@ select {
|
||||
<p><strong>Mean:</strong> <span id="mean"></span> - <strong>Standard Deviation:</strong> <span id="stdDev"></span></p>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Chart -->
|
||||
<div id="bellCurveChart"></div>
|
||||
|
||||
@@ -122,27 +119,36 @@ select {
|
||||
<script src="https://cdn.jsdelivr.net/npm/echarts@5.3.2/dist/echarts.min.js"></script>
|
||||
<script>
|
||||
const nodes = {{ nodes | tojson }};
|
||||
let filteredNodes = [...nodes];
|
||||
let filteredNodes = [];
|
||||
|
||||
// Chart & Stats
|
||||
const chart = echarts.init(document.getElementById('bellCurveChart'));
|
||||
const meanEl = document.getElementById('mean');
|
||||
const stdEl = document.getElementById('stdDev');
|
||||
|
||||
// Populate Channel Dropdown
|
||||
// Populate Channel Dropdown (without "All"), default to "LongFast"
|
||||
const channelSet = new Set();
|
||||
nodes.forEach(n => channelSet.add(n.channel));
|
||||
const dropdown = document.getElementById('channelFilter');
|
||||
[...channelSet].sort().forEach(channel => {
|
||||
const sortedChannels = [...channelSet].sort();
|
||||
|
||||
sortedChannels.forEach(channel => {
|
||||
const option = document.createElement('option');
|
||||
option.value = channel;
|
||||
option.textContent = channel;
|
||||
if (channel === "LongFast") {
|
||||
option.selected = true;
|
||||
}
|
||||
dropdown.appendChild(option);
|
||||
});
|
||||
|
||||
// Default to LongFast filter on load
|
||||
filteredNodes = nodes.filter(n => n.channel === "LongFast");
|
||||
|
||||
// Filter change handler
|
||||
dropdown.addEventListener('change', () => {
|
||||
const val = dropdown.value;
|
||||
filteredNodes = val === "all" ? [...nodes] : nodes.filter(n => n.channel === val);
|
||||
filteredNodes = nodes.filter(n => n.channel === val);
|
||||
updateTable();
|
||||
updateStatsAndChart();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user