Example #1
0
 $graph = $plugin->getGraphByName($graphName);
 if ($graph == null) {
     $response['msg'] = 'Invalid graph type';
     $response['status'] = 'err';
     break;
 }
 // if it's a pie chart, it's easier
 if ($graph->getType() == GraphType::Pie || $graph->getType() == GraphType::Donut) {
     $response['status'] = 'ok';
     $response['data'] = DataGenerator::generateCustomChartData($graph, -1, $hours);
     $response['name'] = htmlentities($graph->getName());
     $response['type'] = GraphType::toString($graph->getType());
 } else {
     if ($graph->getType() == GraphType::Map) {
         $response['status'] = 'ok';
         $response['data'] = DataGenerator::generateGeoChartData($plugin);
         $response['name'] = htmlentities($graph->getName());
         $response['type'] = GraphType::toString($graph->getType());
     } else {
         foreach ($graph->getColumns() as $columnID => $columnName) {
             if (is_numeric($columnName) || is_double($columnName)) {
                 $columnName = "" . $columnName;
             }
             $response['data'][utf8_encode($columnName)] = DataGenerator::generateCustomChartData($graph, $columnID, $hours);
         }
         // total the counts
         $total = 0;
         foreach ($response['data'] as $name => $data) {
             $count = count($data);
             // evict the column if it has none (wasting space !)
             if ($count == 0) {