summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoruser <user@node5.net>2024-03-24 00:01:47 +0100
committeruser <user@node5.net>2024-03-24 00:01:47 +0100
commit5995864720f7c6b1e53196b500e6727011b99a7c (patch)
treef55f5cf6d1f3c7716db0c12476b9d7e45c86f2e5 /src
parentd5b39d63a143fd1634d54f65932ad4899e71aad6 (diff)
chart - random colors
Diffstat (limited to 'src')
-rw-r--r--src/ssh_node5_net.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ssh_node5_net.py b/src/ssh_node5_net.py
index 77bd36b..0b1d37a 100644
--- a/src/ssh_node5_net.py
+++ b/src/ssh_node5_net.py
@@ -1,6 +1,7 @@
import json
import logging
import datetime
+import random
import flask
@@ -74,9 +75,9 @@ def index():
by_ip[data['ip']][all_dates.index(data['date'])] = data['total_count']
histogram_chartjs = json.dumps([{
- 'label': str(ip),
- 'data': data,
- 'backgroundColor': f'hsl({abs(360 if index%2 else 0 - (index / len(by_ip) * 360))}, 50%, 50%)',
+ 'label': str(ip),
+ 'data': data,
+ 'backgroundColor': f'hsl({random.randrange(0,360)}, 50%, 50%)',
'fill': 'start'
} for index, (ip, data) in enumerate(by_ip.items())])