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

Improvements to presenting graphs. number format and axis labeling

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@987 44740490-163a-0410-bde0-09ae8108e29a
parent 9c4e0e37
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,7 @@ function show($axis, $axispos, $values, $max) {
$nv = count($values);
$url = 'http://chart.apis.google.com/chart?' .
'chs=800x250' .
'chs=800x350' .
'&chd=' . encodedata($values) .
'&cht=lc' .
'&chxt=x,y' .
......@@ -135,9 +135,12 @@ if (isset($_REQUEST['d'])) {
}
$maxvalue = 0;
$maxvaluetime = 0;
$debugdata = array();
foreach($results AS $slot => $res) {
if ($res[$delimiter] > $maxvalue) { $maxvaluetime = prettydate($slot, $statrules[$rule]['slot'], $offset, $statrules[$rule]['dateformat-intra']); }
$maxvalue = max($res[$delimiter],$maxvalue);
$debugdata[] = array(
prettydate($slot, $statrules[$rule]['slot'], $offset, $statrules[$rule]['dateformat-intra']),
$res[$delimiter]
......@@ -145,6 +148,9 @@ foreach($results AS $slot => $res) {
}
$max = roof($maxvalue);
#echo 'Maxvalue [' . $maxvalue . '] at time ' . $maxvaluetime; exit;
#echo '<pre>'; print_r($debugdata); exit;
$availdelimiters = array();
......@@ -156,7 +162,7 @@ foreach($results AS $slot => $res) {
#echo '<p>' . date($dateformat, $slot*$granularity) . ': ' . (isset($results[$slot]) ? $results[$slot] : 0);
$dataset[] = 100*$res[$delimiter] / $max;
$dataset[] = number_format(100*$res[$delimiter] / $max, 2);
foreach(array_keys($res) AS $nd) $availdelimiters[$nd] = 1;
#$dataset[] = (isset($results[$slot]) ? round(($results[$slot]*$perseconds/($granularity*$max))*100) : 0);
......@@ -169,7 +175,7 @@ foreach($results AS $slot => $res) {
$lastslot = $slot;
$i++;
}
$axis[] = date($dateformat_intra, ($lastslot*$slotsize) + $slotsize);
$axis[] = date($dateformat_intra, ($lastslot*$slotsize) + $slotsize - $offset);
#echo "<p> ". ($lastslot+1) . " = " . date($dateformat_intra, (($lastslot+1)*$slotsize - $offset) ) . " ";
#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