--- a/documents/charts.php +++ b/documents/charts.php @@ -5,11 +5,20 @@ $agenciesdb = $server->get_db('disclosr-agencies'); $idtoname = Array(); +$idtofoirequestssuccessful = Array(); foreach ($agenciesdb->get_view("app", "byCanonicalName")->rows as $row) { $idtoname[$row->id] = trim($row->value->name); + $foirequestssuccessful = 0; +if(isset($row->value->statistics->foiRequests)) { + foreach ($row->value->statistics->foiRequests as $statperiod) { + $statperiod=object_to_array($statperiod); + if (isset($statperiod["Requests for other information granted in full"])) $foirequestssuccessful += $statperiod["Requests for other information granted in full"]; + if (isset($statperiod["Requests for other information granted in part"])) $foirequestssuccessful += $statperiod["Requests for other information granted in part"]; + } +} + $idtofoirequestssuccessful[$row->id] =$foirequestssuccessful; } $foidocsdb = $server->get_db('disclosr-foidocuments'); - ?>

Charts

@@ -28,7 +37,6 @@ get_view("app", "byDateMonthYear?group=true",null, false,false,true)->rows; - $dataValues = Array(); foreach ($rows as $row) { @@ -95,6 +103,7 @@ }; var d2 = []; + var d3 = []; var agencylabels = []; function agencytrackformatter(obj) { @@ -122,6 +131,7 @@ $i = 0; foreach ($rows as $row) { echo " d2.push([ $row->value,$i]);" . PHP_EOL; + echo " d3.push([ ".$idtofoirequestssuccessful[$row->key].",$i]);" . PHP_EOL; echo " agencylabels.push(['".str_replace("'","",$idtoname[$row->key])."']);" . PHP_EOL; $i++; @@ -158,7 +168,7 @@ autoscaleMargin: 1 }, legend: { - show: false + show: true } } );