function indexAction() { // $this->_helper->layout->disableLayout(); // $login = "******"; // $password = "******"; // include_once 'sina.php'; // $resultarray = get_sinacontacts($login, $password); // Zend_Debug::dump($resultarray); // include_once '163.php'; // $login = '******'; // $password = '******'; // $resultarray = get_163contacts($login, $password); // Zend_Debug::dump($resultarray); // include_once 'yahoo.php'; // $obj = new GrabYahoo(); // $contacts = $obj->getAddressbook('*****@*****.**','19990402'); // Zend_Debug::dump($contacts); // include_once "contacts_fn.php"; // $ret_array = get_msncontacts('*****@*****.**', '1999040211'); // Zend_Debug::dump($ret_array); // $this->_helper->layout->setLayout("layout_admin"); $this->_helper->layout->disableLayout(); // get date from db $db = Zend_Registry::get('db'); $select = $db->select(); $select->from('report', array('left(create_date,10) as date', 'accesscode'))->where('report.campaign_id = 3')->where("report.state = 'APPROVED'")->order('date'); $results = $db->fetchAll($select); $accesscodeDbMatchArray = array(); foreach ($results as $result) { $accesscodeDbMatchArray[$result['accesscode']] = $result['date']; } $accesscodeArray = array_keys($accesscodeDbMatchArray); // Zend_Debug::Dump($accesscodematchArray); // get value from ws $indicate2Connect = new Indicate2_Connect(); $response = $indicate2Connect->getAnswerSetForSurvey(385, null, array(array('ContextIndex' => 1, 'QuestionIndex' => 1), array('ContextIndex' => 1, 'QuestionIndex' => 4)), 0); // Zend_Debug::Dump($response); $talkingdurationArray = array(); $accesscodeResponseMathArray = array(); if (isset($response->AnswerSetType)) { foreach ($response->AnswerSetType as $answerSet) { if (isset($answerSet->AnswerType) && is_array($answerSet->AnswerType) && !empty($answerSet->AnswerType)) { foreach ($answerSet->AnswerType as $answer) { if ($answer->QuestionId == 573) { $accesscodeResponseMathArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answer->AnswerText))); } if ($answer->QuestionId == 576) { $talkingdurationArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answer->AnswerText))); } } } else { //get min value, like '11-15' = 11 $accesscodeResponseMathArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answerSet->AnswerType->AnswerText))); } } } // Zend_Debug::Dump($accesscodeResponseMathArray); // Zend_Debug::Dump($talkingdurationArray); $resultmatchArray = array(); foreach ($accesscodeArray as $accesscode) { $resultmatchArray[$accesscodeDbMatchArray[$accesscode]] = 0; } foreach ($accesscodeArray as $accesscode) { if (array_key_exists($accesscode, $accesscodeResponseMathArray)) { $resultmatchArray[$accesscodeDbMatchArray[$accesscode]] += $accesscodeResponseMathArray[$accesscode]; } } // Zend_Debug::Dump($resultmatchArray); $dateArray = array_keys($resultmatchArray); foreach ($dateArray as $date) { $resultmatchArray[$date] = floor($resultmatchArray[$date] * 1.65); } // Zend_Debug::Dump($resultmatchArray); include 'open-flash-chart.php'; $data_1 = array(); $base = floor(1472 * 1.65); $temp = 0; $resultmatchArray[0] = 0; foreach ($dateArray as $date) { $resultmatchArray[$date] += $resultmatchArray[$temp]; $data_1[] = $resultmatchArray[$date] + $base; $temp = $date; } // Zend_Debug::Dump($data_1); $title = new title("Impressions of BugsLock by day"); $y = new y_axis(); $y->set_range(0, 40000, 10000); $x = new x_axis(); $x_labels = new x_axis_labels(); $x_labels->set_labels($dateArray); $x_labels->set_steps(2); $x_labels->rotate(40); $x->set_labels($x_labels); $line_1_default_dot = new dot(); $line_1_default_dot->colour('#f00000')->tooltip('#x_label#: #val#'); $line_1 = new line(); $line_1->set_default_dot_style($line_1_default_dot); $line_1->set_values($data_1); $line_1->set_width(1); $line_1->set_key('Impression', 10); $this->view->chart = new open_flash_chart(); $this->view->chart->set_title($title); $this->view->chart->add_element($line_1); $this->view->chart->set_y_axis($y); $this->view->chart->set_x_axis($x); $this->view->chart->set_bg_colour('#FFFFFF'); // include 'ofc_sugar.php'; $this->view->chart2 = new open_flash_chart(); $this->view->chart2->set_title(new title('Generation Chart')); $line_1 = new line(); $array_1 = array(); $f = 1.5; for ($i = 0; $i <= 50; $i++) { array_push($array_1, $f); } $line_1->set_values($array_1); // $line_1->set_default_dot_style( new s_hollow_dot('#FBB829', 4) ); $line_1->set_width(1); $line_1->set_colour('#FF0000'); $line_1->set_tooltip("Gen0"); $line_1->set_key('Gen0', 10); $line_1->loop(); $area = new area(); // set the circle line width: $area->set_width(1); // $area->set_default_dot_style( new s_hollow_dot('#45909F', 5) ); $area->set_colour('#FF0000'); // $area->set_fill_colour( '#FF0000' ); // $area->set_fill_alpha( 0.4 ); $area->set_loop(); $area->set_values($array_1); $line_2 = new line(); $array_2 = array(); $f = 2.8; for ($i = 0; $i <= 50; $i++) { array_push($array_2, $f); } $line_2->set_values($array_2); // $line_2->set_default_dot_style( new s_hollow_dot('#FBB829', 4) ); $line_2->set_width(1); $line_2->set_colour('#FBB829'); $line_2->set_tooltip("Gold<br>#val#"); $line_2->set_key('Gen1', 10); $line_2->loop(); $line_4 = new line(); $array_4 = array(); $f = 5; for ($i = 0; $i <= 50; $i++) { array_push($array_4, $f); } $line_4->set_values($array_4); // $line_2->set_default_dot_style( new s_star('#8000FF', 4) ); $line_4->set_width(1); $line_4->set_colour('#3030D0'); $line_4->set_tooltip("Purple<br>#val#"); $line_4->set_key('Gen2', 10); $line_4->loop(); // add the area object to the chart: $this->view->chart2->add_element($line_1); $this->view->chart2->add_element($line_2); $this->view->chart2->add_element($line_4); $r = new radar_axis(5); $r->set_colour('#FFFFFF'); $r->set_grid_colour('#FFFFFF'); $labels = new radar_axis_labels(array('G0', '', 'G1', '', 'G2')); $labels->set_colour('#9F819F'); $r->set_labels($labels); $this->view->chart2->set_radar_axis($r); $tooltip = new tooltip(); $tooltip->set_proximity(); $this->view->chart2->set_tooltip($tooltip); $this->view->chart2->set_bg_colour('#ffffff'); // echo $this->view->chart2->toPrettyString(); }
/** * Alias for FlashChart::chart('radar'); * * The Radar chart needs special axis and also * have special methods for stokes and labes * * @todo Each value can have it's own tooltip using the dot_value class * * @example echo $flashChart->radar(array('loop'=>false','colour'=>'336699')); * @example echo $flashChart->radar(array('type'=>filled'),'Dataset2'); * @param array $options * @param string $datasetName The name to be used to associate charts with data * @param string $chartId Name of chart. Use for seperate charts. * @return string */ public function radar($options = array(), $datasetName = 'default', $chartId = 'default') { if (empty($this->data[$datasetName])) { return false; } $this->Chart->set_bg_colour($this->bg_colour); if (isset($options['type']) && $options['type'] == 'filled') { $line = new area_hollow(); } else { $line = new line_hollow(); if (!isset($options['loop']) || isset($options['loop']) && $options['loop']) { $line->loop(); } if (isset($options['loop'])) { unset($options['loop']); } } $values = $this->getNumbers($datasetName); /* @todo code below is not getting expected result if (isset($options['tooltip_path'])) { $numbers = $values; $values = array(); $tooltips = Set::extract($xpath,$this->data[$datasetName]); if (isset($options['tooltip_colour'])) { $colour = $options['tooltip_colour']; unset($options['tooltip_colour']); } else { $colour = $this->grid_colour; } foreach ($numbers as $key => $number) { $tmp = new dot_value( $number, $colour ); $tmp->set_tooltip($tooltips[$key]); $values[] = $tmp; } unset($options['tooltip_path']); }*/ if (isset($options['type'])) { unset($options['type']); } foreach ($options as $key => $setting) { $set_method = 'set_' . $key; if (is_array($setting)) { $line->{$set_method}($setting[0], $setting[1]); } else { $line->{$set_method}($setting); } } $radar_axis_object = new radar_axis($this->radarAxis['max']); $radar_axis_object->set_steps($this->radarAxis['steps']); $radar_axis_object->set_colour($this->radarAxis['colour']); $radar_axis_object->set_grid_colour($this->radarAxis['grid_colour']); if (!empty($this->radarAxis['labels'])) { $labels = new radar_axis_labels($this->radarAxis['labels']); $labels->set_colour($this->radarAxis['label_colour']); $radar_axis_object->set_labels($labels); } if (!is_null($this->spoke_labels)) { $radar_axis_object->set_spoke_labels($this->spoke_labels); } $this->Chart->set_radar_axis($radar_axis_object); $line->set_values($values); $this->Chart->add_element($line); return $this->renderData($chartId); }
$area_w->set_fill_colour('#EFC01D'); $area_w->set_fill_alpha(0.4); $area_w->set_loop(); $area_w->set_values($vals); $line_t = new line(); $line_t->set_values($data_t); $max = max($data_t) * 1.15; $label = array(); for ($i = 0; $i < $max; $i = $i + round($max * 0.1, -1)) { $label[] = $i; } $r = new radar_axis($max); $r->set_colour('#EFD1EF'); $r->set_steps(round($max * 0.1, -1)); $r->set_grid_colour('#EFD1EF'); $labels = new radar_axis_labels($label); $labels->set_colour('#9F819F'); $r->set_labels($labels); $spoke_labels = new radar_spoke_labels($time_axis); $spoke_labels->set_colour('#9F819F'); $r->set_spoke_labels($spoke_labels); $tooltip = new tooltip(); $tooltip->set_hover(); $chart = new open_flash_chart(); $chart->set_title($title); $chart->set_tooltip($tooltip); $chart->set_bg_colour('#ffffff'); $chart->set_radar_axis($r); $chart->add_element($area_w); echo $chart->toString(); }