function get_trend_pulses() { session_write_close(); $params = array('range' => 7); $graph = array(); $otx = new Otx(); $trend = $otx->get_events_from_all_pulses($params); if (is_array($trend) && count($trend) > 0) { $legend = build_legend(7); foreach ($legend as $l) { $graph[] = array('date' => $l, 'value' => intval($trend[$l]['value'])); } } return $graph; }