$line_watt->set_values($data_watt); $line_watt->set_colour('#4D4D4D'); $line_watt->set_fill_colour('#EFC01D'); $line_watt->set_fill_alpha(0.75); $line_watt->set_width(2); $line_watt->set_key('Leistung (W)', 10); $line_watt->set_tooltip("#val# W"); $line_tot_default_dot = new dot(); $line_tot_default_dot->size(4)->halo_size(2); $line_tot = new line(); $line_tot->set_default_dot_style($line_tot_default_dot); $line_tot->set_values($data_tot); $line_tot->set_colour('#A0A000'); $line_tot->set_width(2); $line_tot->set_key('Gesamt (kWh)', 10); $line_tot->set_tooltip("#val# kWh"); $max = max(max($data_watt), $max_val) * 1.15; $y = new y_axis(); $y->set_range(0, $max, round($max * 0.1, -1)); $x_labels = new x_axis_labels(); $x_labels->set_vertical(); $x_labels->set_steps(6); $x_labels->set_colour('#333333'); $x_labels->set_labels($time_axis); $x = new x_axis(); $x->set_colour('#333333'); $x->set_grid_colour('#ffffff'); $x->set_offset(false); $x->set_steps(3); // Add the X Axis Labels to the X Axis $x->set_labels($x_labels);
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(); }
$perc = round($data_curr[$i] / $data_soll[$i] * 100, 1); } else { $perc = 0; } $bval->set_tooltip($data_curr[$i] . ' kWh - ' . $perc . ' %'); if ($data_curr[$i] == max($data_curr)) { $bval->set_colour('#ef4747'); } $bars_curr->append_value($bval); } $line_soll = new line(); $line_soll->set_values($data_soll); $line_soll->set_colour('#BFA447'); $line_soll->set_width(2); $line_soll->set_key('Soll Tagesleistung (kWh)', 10); $line_soll->set_tooltip("#val# kWh"); $max = max($data_curr) * 1.15; $y = new y_axis(); $y->set_range(0, $max, round($max * 0.1, 0)); $x_labels = new x_axis_labels(); $x_labels->set_vertical(); $x_labels->set_colour('#333333'); $x_labels->set_labels($time_axis); $x = new x_axis(); $x->set_colour('#333333'); $x->set_grid_colour('#ffffff'); $x->set_labels($x_labels); $chart = new open_flash_chart(); $chart->set_tooltip($tooltip); $chart->set_title($title); if (max($data_soll) > 0) {
$count = intval($line['value']); if (!is_int($count)) { $count = 0; } $array[] = $count; $v = intval($line['avg']); if (is_int($v)){ $avg[] = $v; } } if (empty($array)) $array[] = 0; $bar->set_values( $array ); $bar->set_tooltip("#val#<br>Average = ".commify($avg[0])); $bar2->set_values( ($avg) ); $bar2->set_colour( "#40FF40" ); $bar2->set_tooltip("#val#<br>Average [#x_label#]"); // // create a Y Axis object // $y = new y_axis(); // grid steps: $y->set_range( 0, max($array), round(max($array)/10)); $chart->set_y_axis( $y ); $x_labels = new x_axis_labels(); $x_labels->set_vertical(); $x_labels->set_labels( $hms ); $x = new x_axis(); $x->set_labels( $x_labels ); $chart->set_x_axis( $x ); echo $chart->toPrettyString(); break;
$bval_plus = null; $bval_minus = new bar_stack_value($data_soll[$i] - $data_curr[$i], '#FFC0C0'); } elseif ($data_curr[$i] > $data_soll[$i]) { $bval_minus = null; $bval_plus = new bar_stack_value($data_curr[$i] - $data_soll[$i], '#1DFF1D'); } $bars_curr->append_stack(array($bval, $bval_minus, $bval_plus)); $bval_minus = null; $bval_plus = null; } $line_soll = new line(); $line_soll->set_values($data_soll); $line_soll->set_colour('#BFA447'); $line_soll->set_width(2); $line_soll->set_key('Soll Tagesleistung (kWh)', 10); $line_soll->set_tooltip(false); $max = max($data_curr) * 1.15; $y = new y_axis(); $y->set_range(0, $max, round($max * 0.1, 0)); $x_labels = new x_axis_labels(); $x_labels->set_vertical(); $x_labels->set_colour('#333333'); $x_labels->set_labels($time_axis); $x = new x_axis(); $x->set_colour('#333333'); $x->set_grid_colour('#ffffff'); $x->set_labels($x_labels); $chart = new open_flash_chart(); $chart->set_title($title); if (max($data_soll) > 0) { $chart->add_element($line_soll);