public function pirepcounts() { # Create the chart //$reportcounts = ''; $data = PIREPData::getIntervalDataByDays(array(), 30); if (!$data) { $data = array(); // so it doesn't error out } $bar_values = array(); $bar_titles = array(); foreach ($data as $val) { $bar_titles[] = $val->ym; $bar_values[] = floatval($val->total); } OFCharts::add_data_set($bar_titles, $bar_values); echo OFCharts::create_line_graph('Past 30 days PIREPS'); }
protected function create_line_graph($title, $data) { if (!$data) { $data = array(); } $titles = array(); $bar_titles = array(); foreach ($data as $val) { $titles[] = $val->ym; $values[] = floatval($val->total); } OFCharts::add_data_set($titles, $values); echo OFCharts::create_line_graph($title); }