summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3f1e878)
raw | patch | inline | side by side (parent: 3f1e878)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 23 Aug 2010 15:24:04 +0000 (15:24 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 23 Aug 2010 15:24:04 +0000 (15:24 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19429 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/generic/statistics/class_statistics.inc | patch | blob | history | |
gosa-core/plugins/generic/statistics/statistics.tpl | patch | blob | history |
diff --git a/gosa-core/plugins/generic/statistics/class_statistics.inc b/gosa-core/plugins/generic/statistics/class_statistics.inc
index cc43dc1243b27adb90db4887d7e94e65bb962672..677b0b24f3a8ce3e3dd37b535f7bb68d352b087e 100644 (file)
}
}
+ // Get action usage, to be able to render a pie chart about most done actions.
+ $gData['actionsPerPluginAction'] = $res['actionsPerPluginAction'];
return($gData);
}
if(!count($gData)){
return;
}
- if(count($gData['actionsPerCategory'])){
- $this->generateCategoryPieGraph($gData['actionsPerCategory']);
- }
+ $this->generateCategoryPieGraph($gData['actionsPerCategory'], 1, _("Plugin usage"));
+ $this->generateCategoryPieGraph($gData['actionsPerPluginAction'], 7,_("Actions"));
$this->generateActionsGraph($gData);
// Generate graph which displays the memory usage over time
/*! \brief Generate the pie-chart which displays the overall-plugin-usage
*/
- function generateCategoryPieGraph($data)
+ function generateCategoryPieGraph($data, $gID, $title)
{
+ $this->graphIDs[$gID] = 0;
+ if(!count($data)) return;
+
// Sort data by usage count and slice array to get
// the eight most used categories
- $gID = 1;
arsort($data);
- $mostUsedCategories = array_slice($data,0,7);
+
+ // Detect max value and throw out entries less than 1%
+ // the will else be unreadable
+ $max = max($data);
+ $pos = 0;
+ foreach($data as $key => $count){
+ if($pos >=7 || ($count / $max)*100 < 1) break;
+ $pos ++;
+ }
+
+ $dataRes = array_slice($data,0,$pos);
// Get the rest of categories and combine them 'others'
- $theRest = array_slice($data,7);
- $mostUsedCategories['remaining'] = array_sum($theRest);
+ $theRest = array_slice($data,$pos);
+ $dataRes['remaining'] = array_sum($theRest);
// Try to find a translation for the given category names
- $values = array_values($mostUsedCategories);
- $keys = array_keys($mostUsedCategories);
+ $values = array_values($dataRes);
+ $keys = array_keys($dataRes);
foreach($keys as $id => $cat){
$keys[$id] = $this->getCategoryTranslation($cat);
}
// Initialise the graph
$chart = new pChart($x,$y);
$chart->setFontProperties($this->font,10);
- $chart->drawPieGraph($dataSet->GetData(),$dataSet->GetDataDescription(),($x/3),($y/2)-10,($y/2),PIE_PERCENTAGE,TRUE,50,20,3);
+ $chart->drawPieGraph($dataSet->GetData(),$dataSet->GetDataDescription(),($x/3),($y/2)-10,($y/2),PIE_PERCENTAGE,TRUE,50,20,6);
$chart->drawPieLegend(($x/3*2),15,$dataSet->GetData(),$dataSet->GetDataDescription(),
$this->legendR,$this->legendG,$this->legendB);
diff --git a/gosa-core/plugins/generic/statistics/statistics.tpl b/gosa-core/plugins/generic/statistics/statistics.tpl
index b848c3fe64989368bb69f173f0800f5161e9297c..4892b4fd1266198250fa92aaae256c20cb8ae3c0 100644 (file)
</table>
<hr>
- {if isset($graphIDs.1) && $graphIDs.1}
- <img src='plugins/statistics/getGraph.php?id={$graphIDs.1}'>
- {/if}
+
+ <table>
+ <tr>
+ <td>
+ {if isset($graphIDs.1) && $graphIDs.1}
+ <img src='plugins/statistics/getGraph.php?id={$graphIDs.1}'>
+ {/if}
+ </td>
+ <td>
+ {if isset($graphIDs.7) && $graphIDs.7}
+ <img src='plugins/statistics/getGraph.php?id={$graphIDs.7}'>
+ {/if}
+ </td>
+ </tr>
+ </table>
<table>
<tr>