summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 165ee18)
raw | patch | inline | side by side (parent: 165ee18)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Aug 2010 09:15:26 +0000 (09:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Aug 2010 09:15:26 +0000 (09:15 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19381 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/generic/statistics/class_statistics.inc | patch | blob | history |
diff --git a/gosa-core/plugins/generic/statistics/class_statistics.inc b/gosa-core/plugins/generic/statistics/class_statistics.inc
index 30fe2cfe5553e5889984a08687cc09e7c853867f..d760eddc2f67d14e45d8c6ade5ce5b11cafd44d3 100644 (file)
$all = array_sum($res['category_count']);
$data = array();
+ $cnt = 5;
foreach($res['category_count'] as $category => $count){
- $tmp[$category] = floor(($count / $all) * 10000) / 100;
- $data[] = array($category, floor(($count / $all) * 10000) / 100);
+ $tmp[$category] = $count;
}
+ asort($tmp);
+ $tmp = array_slice($tmp,0,7);
- $this->graphID_1 = preg_replace("/[^0-9]/","",microtime(TRUE));
- $plot = new PHPlot(600,400);
- $plot->SetImageBorderType('plain');
+ // Include pChart
+ new pChartInclude();
- $plot->SetTitle("World Gold Production, 1990\n(1000s of Troy Ounces)");
- $plot->SetPlotType('pie');
- $plot->SetDataType('text-data-single');
- $plot->SetDataValues($data);
+ // Dataset definition
+ $DataSet = new pData;
+ $this->graphID_1 = preg_replace("/[^0-9]/","",microtime(TRUE));
+ $DataSet->AddPoint(array_values($tmp),"Serie1");
+ $DataSet->AddPoint(array_keys($tmp),"Serie2");
+ $DataSet->AddAllSeries();
+ $DataSet->SetAbsciseLabelSerie("Serie2");
- foreach ($data as $row)
- $plot->SetLegend(implode(': ', $row));
+ // Initialise the graph
+ $Test = new pChart(400,200);
+ $Test->drawFilledRoundedRectangle(7,7,373,193,5,255,200,200);
+ $Test->drawRoundedRectangle(5,5,375,195,5,200,255,200);
+ // Draw the pie chart
+ $Test->setFontProperties("./themes/default/fonts/LiberationSans-Regular.ttf",8);
+ $Test->drawPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),150,90,110,PIE_PERCENTAGE,TRUE,50,20,5);
+ $Test->drawPieLegend(310,15,$DataSet->GetData(),$DataSet->GetDataDescription(),200,255,200);
- $plot->SetOutputFile('/tmp/graph_'.$this->graphID_1);
- $plot->SetIsInline(TRUE);
- $plot->DrawGraph();
+ $file = '/tmp/graph_'.$this->graphID_1;
+ $Test->Render($file);
- session::set('statistics::graphFile'.$this->graphID_1,'/tmp/graph_'.$this->graphID_1);
+ session::set('statistics::graphFile'.$this->graphID_1,$file);
}
}