//echo json_encode($datahold2); $data["nodesresecentrum"] = array_slice($datahold3, 1); foreach ($data as $node) { if ($node == $data["nodeshamspangen"]) { $temp = array(); foreach ($node as $point) { $temp[$point['FIELD1']] = $point['FIELD2']; } array_push($bikers, $temp); } else { array_push($bikers, dateGrouper($node, 'FIELD1', 'FIELD2')); } //echo json_encode($bikers); } $paramarray = array(); $paramarray["un"] = "MajaEngvall"; $paramarray["key"] = "yeea6i8qtf"; $paramarray["filename"] = '"hamnspangen"'; $paramarray["title"] = '"Cykelflöde Dag H."'; $paramarray["yaxis"] = '"Resecentrum"'; $paramarray["yaxis-title"] = '"Antal cyklar"'; $paramarray["xaxis-title"] = '"Datum"'; uppdateplotly(array_slice($bikers[0], -90), $paramarray); $paramarray["filename"] = '"nod_hamnspangen"'; $paramarray["title"] = '"Cykelflöde Hamnspången."'; uppdateplotly(array_slice($bikers[1], -90), $paramarray); $paramarray["filename"] = '"nod_resecentrum"'; $paramarray["title"] = '"Cykelflöde Resecentrum"'; uppdateplotly(array_slice($bikers[2], -90), $paramarray); //var_dump(addDateGroups($bikers)); echo json_encode($bikers);
//echo(datemakerGraph($document['FIELD2'])); array_push($datahold, $temp); } foreach ($cursor2 as $document2) { array_push($datahold2, $document2); } foreach ($cursor3 as $document3) { array_push($datahold3, $document3); } $bikers = array(); $data["nodesdaghammar"] = array_slice($datahold, 1); $data["nodeshamspangen"] = array_slice($datahold2, 1); $data["nodesresecentrum"] = array_slice($datahold3, 1); foreach ($data as $node) { array_push($bikers, dateGrouper($node, 'FIELD1', 'FIELD2')); } $paramarray = array(); $paramarray["un"] = "MajaEngvall"; $paramarray["key"] = "yeea6i8qtf"; $paramarray["filename"] = '"hamnspangen"'; $paramarray["title"] = '"Cykelflöde Dag H."'; $paramarray["yaxis"] = '"Resecentrum"'; uppdateplotly($bikers[0], $paramarray); $paramarray["filename"] = '"nod_hamnspangen"'; $paramarray["title"] = '"Cykelflöde Hamnspången."'; uppdateplotly($bikers[1], $paramarray); $paramarray["filename"] = '"nod_resecentrum"'; $paramarray["title"] = '"Cykelflöde Resecentrum"'; uppdateplotly($bikers[2], $paramarray); //var_dump(addDateGroups($bikers)); echo json_encode($bikers);
<?php require '../phpincludes/phputil.php'; require '../phpincludes/plotupdate.php'; $params = array('un' => 'Gustafv', 'key' => 'af5a12w562', 'filename' => '"tweetplot"', 'title' => '"Tweets over time"'); $from = datemakerStandard($_POST['from']); $until = datemakerStandard($_POST['until'] . 'tomorrow'); $searchword = $_POST['searchWord']; $datebounds = array($from, $until); $cursor1 = dataBaseCall('coordTweets'); $cursor2 = dataBaseCall('uppsalaTweets'); $data1 = tweetRefinedDataparser(tweetDataparser($cursor1, $datecheck, 'created_at', $datebounds), $wordcheck, 'Text', $searchword); $data2 = tweetRefinedDataparser(tweetDataparser($cursor2, $datecheck, 'created_at', $datebounds), $wordcheck, 'Text', $searchword); $plotlydata = addDateGroups(array(dateGrouper($data1, 'date', 'value'), dateGrouper($data2, 'date', 'value'))); uppdateplotly($plotlydata, $params); $data = array($data1, $cursor1->count() + $cursor2->count(), count($data1) + count($data2)); echo json_encode($data);