Skip to content
Snippets Groups Projects
Commit 0b57b5f9 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg
Browse files

Do not show graph line at zero when there is not data...

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1373 44740490-163a-0410-bde0-09ae8108e29a
parent 2570aa4d
No related branches found
No related tags found
No related merge requests found
......@@ -113,17 +113,34 @@ class sspmod_statistics_Aggregator {
foreach ($ruleresults AS $fileno => $fileres) {
$slotlist = array_keys($fileres);
$maxslot = $slotlist[count($slotlist)-1];
#print_r($slotlist);
// Get start and end slot number within the file, based on the fileslot.
$start = $datehandler->toSlot($datehandler->fromSlot($fileno, $this->statrules[$rulename]['fileslot']), $this->statrules[$rulename]['slot']);
$end = $datehandler->toSlot($datehandler->fromSlot($fileno+1, $this->statrules[$rulename]['fileslot']), $this->statrules[$rulename]['slot']);
$start = (int)$datehandler->toSlot($datehandler->fromSlot($fileno, $this->statrules[$rulename]['fileslot']), $this->statrules[$rulename]['slot']);
$end = (int)$datehandler->toSlot($datehandler->fromSlot($fileno+1, $this->statrules[$rulename]['fileslot']), $this->statrules[$rulename]['slot']);
// Fill in missing entries and sort file results
$filledresult = array();
for ($slot = $start; $slot < $end; $slot++) {
$filledresult[$slot] = (isset($fileres[$slot])) ? $fileres[$slot] : array('_' => 0);
#print_r(gettype($slot));
if (array_key_exists($slot, $fileres)) {
$filledresult[$slot] = $fileres[$slot];
} else {
#echo('SLot [' . $slot . '] of [' . $maxslot . ']' . "\n");
if ($slot > $maxslot) {
$filledresult[$slot] = array('_' => -1);
} else {
$filledresult[$slot] = array('_' => NULL);
}
}
#print_r($filledresult[$slot]);
# = (isset($fileres[$slot])) ? $fileres[$slot] : array('_' => NULL);
}
#print_r($filledresult); exit;
// store file
file_put_contents($this->statdir . '/' . $rulename . '-' . $fileno . '.stat', serialize($filledresult), LOCK_EX );
}
......
......@@ -156,6 +156,10 @@ $maxvaluetime = 0;
$debugdata = array();
/*
* Search for maximum value in order to scale the Y-scale of the graph presentation.
*/
$maxdelimiter = $delimiter;
if (array_key_exists('graph.total', $statrules[$rule]) && $statrules[$rule]['graph.total'] === TRUE) {
$maxdelimiter = '_';
......@@ -223,7 +227,11 @@ function getPercentValues($results, $delimiter) {
foreach($results AS $slot => $res) {
#echo ('<p>new value: ' . number_format(100*$res[$delimiter] / $max, 2));
if (array_key_exists($delimiter, $res)) {
$dataset[] = number_format(100*$res[$delimiter] / $max, 2);
if ($res[$delimiter] === -1) {
$dataset[] = -1;
} else {
$dataset[] = number_format(100*$res[$delimiter] / $max, 2);
}
} else {
$dataset[] = '0';
}
......@@ -252,6 +260,8 @@ if ($delimiter !== '_') {
}
}
#echo('<pre>'); print_r($datasets); exit;
#echo 'set axis on lastslot [' . $lastslot . ']';
$axis[] = $datehandler->prettyDateSlot($lastslot+1, $slotsize, $dateformat_intra);
#print_r($axis);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment