From: Brian Flowers Date: Thu, 3 Nov 2016 00:42:08 +0000 (-0400) Subject: CSS changes for graph iframes X-Git-Url: http://git.slightlycyberpunk.com%2C%20git.slightlycyberpunk.com/git/?a=commitdiff_plain;h=2d47125076a25103f5f11e39e0c62081f4473eae;p=bdsm-web.git CSS changes for graph iframes --- diff --git a/graph.php b/graph.php index 4f513d7..12802b9 100644 --- a/graph.php +++ b/graph.php @@ -1,17 +1,20 @@ query("SELECT DISTINCT host FROM MEASUREMENTS"); -while($host = $result->fetchArray(SQLITE3_ASSOC)) +$result = $db->query("SELECT DISTINCT host FROM MEASUREMENTS;"); +$hosts = Array(); +while($host = $result->fetch()) if ( $host['host'] ) array_push($hosts, $host['host']); -$host = $_GET['host']; +$host = urldecode($_GET['host']); + +//print_r($hosts); +//$result = $db->query("SELECT * FROM bdsmweb;"); +//print_r($result->fetch()); if( !in_array($host, $hosts) ) die("Error: Host not found."); - - ?> @@ -32,25 +35,26 @@ if( !in_array($host, $hosts) ) } context.stroke(); context.beginPath(); - + context.strokeStyle = "#000"; for (var i = 50; i < 400; i+=50) { context.moveTo(0, i); context.lineTo(400, i); } - + context.stroke(); context.beginPath(); context.lineWidth = 2; - query("SELECT attribute, name FROM bdsmweb WHERE host='$host' AND graph=1"); + $result = $db->query("SELECT attribute, name FROM bdsmweb WHERE host='$host' AND graph=1;"); $attributes = Array(); - while($attribute = $result->fetchArray(SQLITE3_ASSOC)) + + while($attribute = $result->fetch()) +{ if ( $attribute['attribute'] ) $attributes[$attribute['attribute']] = $attribute['name']; - +} $i = 0; foreach (array_keys($attributes) as $attribute) { @@ -59,13 +63,13 @@ if( !in_array($host, $hosts) ) "WHERE host='$host' AND attribute='$attribute' ". "ORDER BY timestamp DESC LIMIT 100"; - $result = $db_handle->query($query); + $result = $db->query($query); echo " context.strokeStyle = '$colors[$i]';\n"; - $record = $result->fetchArray(SQLITE3_ASSOC); + $record = $result->fetch(); $final = $record['timestamp']; echo " context.moveTo(0, ".sprintf("%d", $record['value']).");\n"; echo " context.beginPath();\n"; - while( $record = $result->fetchArray(SQLITE3_ASSOC) ) + while( $record = $result->fetch() ) { echo " context.lineTo(".sprintf("%d", $final - $record['timestamp']).", ".(400-$record['value']*4).");\n"; } diff --git a/styles.css b/styles.css index dc13c27..f63e243 100644 --- a/styles.css +++ b/styles.css @@ -1,6 +1,6 @@ #vmenu { - position: absolute; + position: fixed; left: 0px; top: 0px; height: 100%; @@ -72,6 +72,7 @@ th .graph { - width: 410px; + width: 410px; height: 410px; + overflow: visible; } \ No newline at end of file