public function up() { $graphType = new GraphType(); $graphType->name = 'xy'; $graphType->save(); $graphType = new GraphType(); $graphType->name = 'bubble'; $graphType->save(); }
foreach ($response['data'] as $name => $data) { $count = count($data); // evict the column if it has none (wasting space !) if ($count == 0) { unset($response['data'][$name]); continue; } $total += $data[$count - 1][1]; // [[0,5], [1,7]] the expression will return 7 } // now evict more data if necessary if ($total > 5000 && count($response['data']) > 20) { $removed_total = 0; foreach ($response['data'] as $name => $data) { $count = count($data); $value = $data[$count - 1][1]; $percent = $value / $total * 100; // evict any data below 0.05% if ($percent <= 0.1) { unset($response['data'][$name]); } } } $response['status'] = 'ok'; $response['name'] = htmlentities($graph->getName()); $response['type'] = GraphType::toString($graph->getType()); } } break; } echo json_encode($response, JSON_NUMERIC_CHECK);