From: Maxious Date: Sat, 20 Oct 2012 11:33:00 +0000 Subject: add zooming to graph X-Git-Url: http://maxious.lambdacomplex.org/git/?p=scannr.git&a=commitdiff&h=c71f839d4d225a70e2a6b28f264115d950041275 --- add zooming to graph --- --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,10 +2,7 @@ - - - @@ -27,11 +24,13 @@ - + - - + + + + @@ -39,16 +38,16 @@ - + - + - + @@ -68,8 +67,8 @@ @@ -261,7 +260,9 @@ - + + + @@ -314,24 +315,26 @@ + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + --- a/calls.json.php +++ b/calls.json.php @@ -2,7 +2,7 @@ include('common.inc.php'); function getTGIDValuesByHour($TGID, $timeFrom, $timeTo) { global $conn; - $sth = $conn->prepare( 'select min(call_timestamp) as time, count(*), min(length), max(length), avg(length), stddev(length) from recordings + $sth = $conn->prepare( 'select tgid, min(call_timestamp) as time, count(*), min(length), max(length), avg(length), stddev(length) from recordings group by tgid, date_trunc(\'hour\', call_timestamp) order by time'); $sth->execute( ); @@ -62,13 +62,17 @@ } -if ($action == "graph") { +if (strpos($action,"graph") !== false) { $values = getTGIDValuesByHour($TGID, $timefrom, $timeto); $label = $TGID; $data = Array(); $tzoffset = get_timezone_offset("UTC"); foreach ($values as $value) { - $data[] = Array((strtotime($value['time']) + $tzoffset) * 1000, intval($value['avg'])); + if ($action == "graphlength") { + $data[$value['tgid']][] = Array((strtotime($value['time']) + $tzoffset) * 1000, intval($value['avg'])); + } else if ($action == "graphcount") { + $data[$value['tgid']][] = Array((strtotime($value['time']) + $tzoffset) * 1000, intval($value['count'])); + } } echo json_encode(Array("label" => $label, "data" => $data, "previous" => Array( @@ -82,5 +86,7 @@ ); } + + ?> --- a/viewcalls.php +++ b/viewcalls.php @@ -5,7 +5,7 @@ ?>
-
<
>
+
<
>