Beispiel #1
0
 public function calculateMax()
 {
     $maxvalue = 0;
     foreach ($this->results as $slot => &$res) {
         if (!array_key_exists($this->delimiter, $res)) {
             $res[$this->delimiter] = 0;
         }
         $maxvalue = max($res[$this->delimiter], $maxvalue);
     }
     $this->max = sspmod_statistics_Graph_GoogleCharts::roof($maxvalue);
 }
Beispiel #2
0
 public function calculateMax()
 {
     /*
      * Get rule specific configuration from the configuration file.
      */
     $slotsize = $this->ruleconfig->getValue('slot');
     $dateformat_period = $this->timeresconfig->getValue('dateformat-period');
     $dateformat_intra = $this->timeresconfig->getValue('dateformat-intra');
     $maxvalue = 0;
     $maxvaluetime = NULL;
     foreach ($this->results as $slot => &$res) {
         if (!array_key_exists($this->delimiter, $res)) {
             $res[$this->delimiter] = 0;
         }
         if ($res[$this->delimiter] > $maxvalue) {
             $maxvaluetime = $this->datehandlerTick->prettyDateSlot($slot, $slotsize, $dateformat_intra);
         }
         $maxvalue = max($res[$this->delimiter], $maxvalue);
     }
     $this->max = sspmod_statistics_Graph_GoogleCharts::roof($maxvalue);
 }
Beispiel #3
0
$datasets[] = $dataset->getPercentValues();
$axis = $dataset->getAxis();
$maxes = array();
$maxes[] = $dataset->getMax();
if (isset($preferRule2)) {
    $statrule = $ruleset->getRule($preferRule2);
    #	$rule2 = $statrule->getRuleID();
    $dataset2 = $statrule->getDataset($preferTimeRes, $preferTime);
    $dataset2->aggregateSummary();
    $dataset2->calculateMax();
    $datasets[] = $dataset2->getPercentValues();
    $maxes[] = $dataset2->getMax();
}
$dimx = $statconfig->getValue('dimension.x', 800);
$dimy = $statconfig->getValue('dimension.y', 350);
$grapher = new sspmod_statistics_Graph_GoogleCharts($dimx, $dimy);
if (array_key_exists('output', $_REQUEST) && $_REQUEST['output'] === 'csv') {
    header('Content-type: text/csv');
    header('Content-Disposition: attachment; filename="simplesamlphp-data.csv"');
    $data = $dataset->getDebugData();
    foreach ($data as $de) {
        if (isset($de[1])) {
            echo '"' . $de[0] . '",' . $de[1] . "\n";
        }
    }
    exit;
}
$t = new SimpleSAML_XHTML_Template($config, 'statistics:statistics-tpl.php');
$t->data['pageid'] = 'statistics';
$t->data['header'] = 'stat';
$t->data['imgurl'] = $grapher->show($axis['axis'], $axis['axispos'], $datasets, $maxes);