mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-05-17 21:30:25 -04:00
Added formatted bitrate values to interface charts
This commit is contained in:
parent
3ace328918
commit
c35f6418a2
2 changed files with 11 additions and 7 deletions
|
@ -1303,8 +1303,8 @@ class InterfaceBandwidthChart:
|
|||
|
||||
self.rx_rates.pop(0)
|
||||
self.tx_rates.pop(0)
|
||||
self.rx_rates.append(rx_delta)
|
||||
self.tx_rates.append(tx_delta)
|
||||
self.rx_rates.append(rx_delta*8)
|
||||
self.tx_rates.append(tx_delta*8)
|
||||
|
||||
if self.update_count >= self.stabilization_updates:
|
||||
self.initialization_complete = True
|
||||
|
@ -1328,14 +1328,14 @@ class InterfaceBandwidthChart:
|
|||
peak_rx = self.peak_rx_for_display if self.initialization_complete else 0
|
||||
peak_tx = self.peak_tx_for_display if self.initialization_complete else 0
|
||||
|
||||
peak_rx_str = format_bytes(peak_rx)
|
||||
peak_tx_str = format_bytes(peak_tx)
|
||||
peak_rx_str = RNS.prettyspeed(peak_rx*8)
|
||||
peak_tx_str = RNS.prettyspeed(peak_tx*8)
|
||||
|
||||
rx_chart = chart.plot(
|
||||
[rx_data],
|
||||
{
|
||||
'height': height,
|
||||
'format': '{:8.1f}',
|
||||
'format': RNS.prettyspeed,
|
||||
'min': 0,
|
||||
'max': self.max_rx_rate * 1.1,
|
||||
}
|
||||
|
@ -1345,7 +1345,7 @@ class InterfaceBandwidthChart:
|
|||
[tx_data],
|
||||
{
|
||||
'height': height,
|
||||
'format': '{:8.1f}',
|
||||
'format': RNS.prettyspeed,
|
||||
'min': 0,
|
||||
'max': self.max_tx_rate * 1.1,
|
||||
}
|
||||
|
|
4
nomadnet/vendor/AsciiChart.py
vendored
4
nomadnet/vendor/AsciiChart.py
vendored
|
@ -46,7 +46,11 @@ class AsciiChart:
|
|||
result = [[' '] * width for i in range(rows + 1)]
|
||||
|
||||
for y in range(min2, max2 + 1):
|
||||
if callable(placeholder):
|
||||
label = placeholder(maximum - ((y - min2) * interval / (rows if rows else 1))).rjust(12)
|
||||
else:
|
||||
label = placeholder.format(maximum - ((y - min2) * interval / (rows if rows else 1)))
|
||||
|
||||
result[y - min2][max(offset - len(label), 0)] = label
|
||||
result[y - min2][offset - 1] = symbols[0] if y == 0 else symbols[1]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue