summaryrefslogtreecommitdiff
path: root/src/viz
diff options
context:
space:
mode:
authorBernhard Tittelbach <bernhard@tittelbach.org>2014-10-25 16:56:32 +0200
committerBernhard Tittelbach <bernhard@tittelbach.org>2014-10-25 17:40:54 +0200
commit1315d1408abce2de7f6452463a3ab4b267cedb1e (patch)
treeaa743fdd4e8f9657b65a8d0f5d124cc884ae2aec /src/viz
parentRevert "viz: fixed json data" (diff)
drop gauge, fix from time
Diffstat (limited to 'src/viz')
-rw-r--r--src/viz/index.html4
-rw-r--r--src/viz/index.js26
2 files changed, 20 insertions, 10 deletions
diff --git a/src/viz/index.html b/src/viz/index.html
index fd3b3db..978b8d8 100644
--- a/src/viz/index.html
+++ b/src/viz/index.html
@@ -4,10 +4,6 @@
<title>Sfive Stats</title>
<link rel="stylesheet" href="index.css" type="text/css" />
<script src="jquery-2.1.1.min.js" ></script>
- <script type="text/javascript" src="https://www.google.com/jsapi"></script>
- <script type="text/javascript">
- google.load('visualization', '1', {packages: ['gauge']});
- </script>
<script type="text/javascript" src="dygraph-combined.js"></script>
<script type="text/javascript" src="index.js"></script>
</head>
diff --git a/src/viz/index.js b/src/viz/index.js
index 31b6880..3a2b136 100644
--- a/src/viz/index.js
+++ b/src/viz/index.js
@@ -1,11 +1,20 @@
var qintv_ms = 5000;
var uripart = "/updates?";
//var lastfrom = "";
-var lastfrom = "from="+(new Date(Date.now() - 600000)).toISOString();
-var possible_display_functions = {"Off":"none", "Value":showvalue, "Gauge":showgauge, "Graph":showasgraph};
+//var lastfrom = "from="+(new Date(Date.now() - 10*60*1000)).toISOString();
+var lastfrom="from=2013-10-24T06:30:45Z&to=2013-10-24T06:32:45";
+console.log(lastfrom);
+//var possible_display_functions = {"Off":"none", "Value":showvalue, "Gauge":showgauge, "Graph":showasgraph};
+var possible_display_functions = {"Off":"none", "Value":showvalue, "Graph":showasgraph};
var stuff_to_display = {"clients":"none","*":showvalue,"client-count":showasgraph, "bytes-sent":showasgraph, "fuckups-per-second":showasgraph};
var sidseen = [];
+toQueryIsoData = function(dateStr) {
+ ts = new Date(dateStr)
+ ts.setTime(ts.getTime() + 1 * 1000) // add a second, lowest resolution step for s5
+ return ts.toISOString();
+}
+
$(document).ready(function()
{
@@ -96,20 +105,24 @@ function changeSetting(name, selobj) {
function graphS5Status(data) {
sidseen=[];
- $.each(data, function(index, stream) {
+ $.each(data.data, function(index, stream) {
var sid = stream["streamer-id"].format + '-' + stream["streamer-id"].quality;
sidseen.push(sid);
- lastfrom = "from="+stream["start-time"];
var jsdate = new Date(stream["start-time"]);
+ var jsdate1s = new Date(jsdate.getTime() + 1000);
+ lastfrom = "from="+jsdate1s.toISOString();
qintv_ms = stream["duration-ms"]; //doesnt really change anything yet
jsdate = new Date(jsdate.getTime() + qintv_ms);
var data = stream.data;
+ //console.log(data);
+ //console.log(graphdata);
for (var key in data) {
+ if (! stuff_to_display[key]) {
+ stuff_to_display[key]=stuff_to_display['*'];
+ }
showasetting(key);
if (typeof(stuff_to_display[key]) == 'function') {
stuff_to_display[key](sid, key, data[key], jsdate);
- } else if (! stuff_to_display[key]) {
- stuff_to_display['*'](sid, key, data[key], jsdate);
}
}
});
@@ -117,6 +130,7 @@ function graphS5Status(data) {
function updateS5Stats() {
var uri = uripart + lastfrom;
+ console.log(uri);
//$.getJSON(uri, "", function(data){alert(data);});
$.ajax({
dataType: "json",