From 68aad5dfdf29d1d021c6bb92c839d8ecb6035f93 Mon Sep 17 00:00:00 2001 From: = Date: Tue, 12 Sep 2017 16:32:00 +0200 Subject: [PATCH] Added draft support of dynamic marker placement --- static/js/index.js | 66 ++++++++++++++++++++++++++++++++++---------- templates/index.html | 25 +++-------------- zmq_subscriber.py | 5 +++- 3 files changed, 60 insertions(+), 36 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index 8825b01..ac5f3f7 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -1,12 +1,17 @@ //color: #5f6062 var updateInterval = 1000*graph_log_refresh_rate; // 1s -var numPoint = 60; +var maxNumPoint = 60; +var maxNumCoord = 20; var emptyArray = []; -var dataNumLog = []; -for(i=0; i res[0] ? globMax : res[0]; @@ -97,8 +102,8 @@ var optionsLineChart = { }, //colors: ["#2fa1db"], yaxis: { min: 0, max: 20 }, - xaxis: { min: 0, max: numPoint-1 }, - ticks: numPoint, + xaxis: { min: 0, max: maxNumPoint-1 }, + ticks: maxNumPoint, grid: { tickColor: "#dddddd", borderWidth: 0 @@ -213,15 +218,9 @@ function updateLogTable(feedName, log) { } } - //if (tableBody.rows.length > logSel.options[logSel.options.selectedIndex].value){ - // while (tableBody.rows.length != logSel.options[logSel.options.selectedIndex].value){ - // tableBody.deleteRow(0); - // } - //} - } -function slide(orig, newData) { +function slideAndMax(orig, newData) { var slided = []; var max = newData; for (i=1; i table { - overflow-y: scroll; + overflow-y: scroll; } + + @@ -152,26 +154,7 @@ table { diff --git a/zmq_subscriber.py b/zmq_subscriber.py index 056e88f..e167c53 100755 --- a/zmq_subscriber.py +++ b/zmq_subscriber.py @@ -31,8 +31,11 @@ pubsub = redis_server.pubsub(ignore_subscribe_messages=True) while True: rdm = random.randint(1,3) - time.sleep(float(rdm / 10)) + time.sleep(float(rdm / 3)) + lat = random.randint(-90,90) + lon = random.randint(-90,90) content = ["rdm "+str(rdm)] + content = [lat,lon] jsonContent = json.dumps(content) to_send = { 'name': 'feeder'+str(rdm), 'log': jsonContent } redis_server.publish(channel, json.dumps(to_send))