From 1b0023485ce85818cccf27ad4024e2b8296a3a63 Mon Sep 17 00:00:00 2001 From: Pablo Revilla Date: Mon, 17 Mar 2025 21:44:46 -0700 Subject: [PATCH] Added numbers to the hop count --- meshview/templates/nodegraph.html | 88 +++++++++++++++++-------------- 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/meshview/templates/nodegraph.html b/meshview/templates/nodegraph.html index 8451a6d..ec32a34 100644 --- a/meshview/templates/nodegraph.html +++ b/meshview/templates/nodegraph.html @@ -116,48 +116,56 @@ {% endfor %} ]; - var option = { - backgroundColor: 'white', - tooltip: { - formatter: function(params) { - return (params.data.long_name || 'Unknown') + ' - ' + (params.data.short_name || 'Unknown'); - } +var option = { + backgroundColor: 'white', + tooltip: { + formatter: function(params) { + if (params.dataType === 'node') { + return (params.data.long_name || 'Unknown') + ' - ' + (params.data.short_name || 'Unknown'); + } else { + return ''; // Hide tooltip for edges + } + } +}, + + animationDurationUpdate: 500, + animationEasingUpdate: 'quinticInOut', + legend: { + data: ['Traceroute', 'NeighborInfo'], + selectedMode: false, + left: 'center', + bottom: '5%', + orient: 'vertical', + textStyle: { + fontSize: 12, + color: '#333' }, - animationDurationUpdate: 1500, - animationEasingUpdate: 'quinticInOut', - legend: { - data: ['Traceroute', 'NeighborInfo'], - selectedMode: false, - left: 'center', - bottom: '5%', - orient: 'vertical', - textStyle: { - fontSize: 12, - color: '#333' - }, - itemWidth: 10, - itemHeight: 10, - padding: [5, 15] + itemWidth: 10, + itemHeight: 10, + padding: [5, 15] + }, +series: [ + { + type: 'graph', + layout: 'force', + data: nodes, + links: edges, + roam: true, + force: { + repulsion: 501, + edgeLength: [100, 200], + gravity: 0.05 }, - series: [ - { - type: 'graph', - layout: 'force', - data: nodes, - links: edges, - roam: true, - force: { - repulsion: 500, - edgeLength: [100, 200], - gravity: 0.05 - }, - lineStyle: { - width: 2, - curveness: 0 - } - } - ] - }; + lineStyle: { + width: 2, + curveness: 0 + }, + edgeLabel: { show: false }, // Hides edge labels + tooltip: { show: false } // Disables tooltips for edges + } +] +}; + chart.setOption(option);