From: hickert Date: Thu, 26 Aug 2010 11:22:37 +0000 (+0000) Subject: Fixed errors in graph generation X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b8c0f517687c9412c6f65fc4dbd62624de4e5b63;p=gosa.git Fixed errors in graph generation git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19463 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc b/gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc index c70ad3830..a983ab28a 100644 --- a/gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc +++ b/gosa-core/plugins/generic/statistics/chartClasses/class_actionSelectChart.inc @@ -20,32 +20,39 @@ class actionSelectChart extends statChart $gData = $this->graphData; $dataSet = new pData; $seriesCnt = 0; + $pCache = new pCache('/var/spool/gosa/'); - if(!isset($gData['actionTypeGraph'][$this->current_action])){ - $this->current_action = key($gData['actionTypeGraph']); - } + // Check if we've received data for the graph we've to render now. + $seriesValid = count($gData['actionTypeGraph']); + if($seriesValid){ - $dataBase = $gData['actionTypeGraph'][$this->current_action]; - - foreach($dataBase as $category => $entriesPerDate){ - if(empty($category) || in_array($category, $this->skipSeries)) continue; + // Ensure that we've a valid action type selected. + if(!isset($gData['actionTypeGraph'][$this->current_action])){ + $this->current_action = key($gData['actionTypeGraph']); + } - // Add results to our data set. - $dataSet->AddPoint($entriesPerDate, $category); - $dataSet->SetSerieName($this->getCategoryTranslation($category), $category); - $dataSet->AddSerie($category); + $dataBase = $gData['actionTypeGraph'][$this->current_action]; - // Detect maximum value, to adjust the Y-Axis - $tmpMax = max($entriesPerDate); - if($tmpMax > $lineMax) $lineMax = $tmpMax; - $seriesCnt ++; - } + foreach($dataBase as $category => $entriesPerDate){ + if(empty($category) || in_array($category, $this->skipSeries)) continue; + + // Add results to our data set. + $dataSet->AddPoint($entriesPerDate, $category); + $dataSet->SetSerieName($this->getCategoryTranslation($category), $category); + $dataSet->AddSerie($category); - // Keep a list of all selecteable data-series, to allow the user to disable - // or enable series on demand. - $this->seriesList = array(); - foreach($dataBase as $key => $data){ - $this->seriesList[$key] = $this->getCategoryTranslation($key); + // Detect maximum value, to adjust the Y-Axis + $tmpMax = max($entriesPerDate); + if($tmpMax > $lineMax) $lineMax = $tmpMax; + $seriesCnt ++; + } + + // Keep a list of all selecteable data-series, to allow the user to disable + // or enable series on demand. + $this->seriesList = array(); + foreach($dataBase as $key => $data){ + $this->seriesList[$key] = $this->getCategoryTranslation($key); + } } // Add timeline @@ -53,7 +60,6 @@ class actionSelectChart extends statChart $dataSet->SetAbsciseLabelSerie('date'); // Read graph from cache? - $pCache = new pCache('/var/spool/gosa/'); if($this->enableCaching && $pCache->IsInCache(get_class(),$dataSet->GetData())){ $filename = $pCache->GetHash(get_class(),$dataSet->GetData()); $filename = '/var/spool/gosa/'.$filename;