function customizeChartProperties() { parent::customizeChartProperties(); $dataSetsToDisplay = $this->getDataSetsToDisplay(); if ($dataSetsToDisplay === false) { return; } $colors = array("0x3357A0", "0xCC3399", "0x9933CC", "0x80a033", "0xFD9816", "0x246AD2", "0xFD16EA", "0x49C100"); $i = 0; foreach ($dataSetsToDisplay as $dataSetToDisplay) { $color = $colors[$i % count($colors)]; $labelName = $this->yLabels[$dataSetToDisplay]; $d = new hollow_dot(); $d->size(3)->halo_size(0)->colour($color); $line = new line(); $line->set_default_dot_style($d); $line->set_key($labelName, 11); $line->set_width(1); $line->set_colour($color); // Line Values // Note: we have to manually create the dot values as the steps feature doens't work on X axis // when it's working again, we can remove code below and set generic tooltip above: // ->tooltip('#x_label#<br>#val# '.$labelName) $yValues = $this->yValues[$dataSetToDisplay]; $labelName = $this->yLabels[$dataSetToDisplay]; $lineValues = array(); $j = 0; $unit = $this->yUnit; foreach ($this->xLabels as $label) { $value = (double) $yValues[$j]; $lineValue = new hollow_dot($value); $whole = (int) $value; if ($value - $whole >= 0.005) { $value = sprintf('%.2f', $value); } $lineValue->tooltip("{$label}<br><b>{$value}{$unit}</b> {$labelName}"); if (!empty($this->xOnClick)) { $lineValue->on_click("piwikHelper.redirectToUrl('" . $this->xOnClick[$j] . "')"); } $lineValues[] = $lineValue; $j++; } $line->set_values($lineValues); $lines[] = $line; $i++; } foreach ($lines as $line) { $this->chart->add_element($line); } // if one column is a percentage we set the grid accordingly // note: it is invalid to plot a percentage dataset along with a numeric dataset if ($this->yUnit == '%' && $this->maxValue > 90) { $this->y->set_range(0, 100, 50); } }
$groups_added[] = $day[$i]['groups']->created + 0; } $max = max($max, $vid_uploads[$i], $user_signups[$i], $groups_added[$i]); } $vid_line = new line(); $vid_line->set_values($vid_uploads); $vid_line->colour('#336600'); $vid_line->set_key('Videos', 14); $user_line = new line(); $user_line->set_values($user_signups); $user_line->colour('#0099cc'); $user_line->set_key('User', 14); $grp_line = new line(); $grp_line->set_values($groups_added); $grp_line->colour('#990000'); $grp_line->set_key('Groups', 14); $max = $max; $steps = round($max / 5, 0.49); $y = new y_axis(); $y->set_range(0, $max, $steps); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($vid_line); $chart->add_element($user_line); $chart->add_element($grp_line); $x_labels = new x_axis_labels(); $x_labels->set_steps(1); $x_labels->set_vertical(); $x_labels->set_colour('#A2ACBA'); $x_labels->set_labels($year); $x = new x_axis();
$line_watt->set_default_dot_style($line_watt_default_dot); $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
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(); }
function getNewUsersByTime($timePhase, $fromDate = '', $toDate = '') { $this->load->library('ofc'); $userId = $this->common->getUserId(); $this->ofc->open_flash_chart(); $this->ofc->set_bg_colour(CHART_BG_COLOR); $toTime = date("Y-m-d", strtotime("-1 day")); if ($timePhase == "7day") { $fromTime = date("Y-m-d", strtotime("-8 day")); $color = CHART_LINE_1; $key = "近7日新增用户"; $title = new title("近7日新增用户统计"); } if ($timePhase == "1month") { $title = new title("近30天新增用户统计"); $fromTime = date("Y-m-d", strtotime("-31 day")); $color = CHART_LINE_2; $key = "近30天新增用户统计"; } if ($timePhase == "3month") { $title = new title("近三个月新增用户统计"); $fromTime = date("Y-m-d", strtotime("-92 day")); $color = CHART_LINE_3; $key = "近三个月新增用户统计"; } if ($timePhase == "all") { $title = new title("所有新增用户统计"); $fromTime = '1970-01-01'; $color = CHART_LINE_4; $key = "所有新增用户统计"; } if ($timePhase == "any") { $title = new title("所有新增用户统计"); $fromTime = $fromDate; $toTime = $toDate; $color = CHART_LINE_4; $key = "所有新增用户统计"; } $fromTime = $this->product->getUserStartDate($userId, $fromTime); $query = $this->newusermodel->getNewUsersByUserId($fromTime, $toTime, $userId); $data = array(); $maxY = 0; $recordCount = $query->num_rows(); $steps = $recordCount - 1 <= 10 ? 2 : (int) (((int) $recordCount - 1) / 10); $xlabelArray = array(); if ($query != null && $query->num_rows() > 0) { foreach ($query->result() as $row) { $dot = new dot(); $dot->size(3)->halo_size(1)->colour($color); $dot->tooltip($row->startdate . " 新增" . $row->totalusers . "用户"); $dot->value((int) $row->totalusers); if ((int) $row->totalusers > $maxY) { $maxY = (int) $row->totalusers; } array_push($xlabelArray, date('y-m-d', strtotime($row->startdate))); array_push($data, $dot); } } $y = new y_axis(); $y->set_range(0, $this->common->getMaxY($maxY), $this->common->getStepY($maxY)); $x = new x_axis(); $x->set_range(0, $recordCount > 1 ? $recordCount - 1 : 1); $x_labels = new x_axis_labels(); $x_labels->set_steps($steps); $x_labels->set_vertical(); $x_labels->set_colour(CHART_LABEL_COLOR); $x_labels->set_size(13); $x_labels->set_labels($xlabelArray); $x_labels->rotate(-25); $x->set_labels($x_labels); $x->set_steps(1); $this->ofc->set_y_axis($y); $this->ofc->set_x_axis($x); $dot = new dot(); $dot->size(3)->halo_size(1)->colour($color); $line = new line(); $line->set_default_dot_style($dot); $line->set_values($data); $line->set_width(2); $line->set_colour($color); $line->colour($color); $line->set_key($key, 12); $this->ofc->add_element($line); $title->set_style("{font-size: 14px; color:#000000; font-family: Verdana; text-align: center;}"); // $x_legend = new x_legend("<a href=\"javascript:changeChartName('chartNewUser')\">新增用户</a> <a href=\"javascript:changeChartName('chartActiveUser')\">活跃用户</a> <a href=\"javascript:changeChartName('chartStartUser')\">启动用户</a>"); // $this->ofc->set_x_legend( $x_legend ); // $x_legend->set_style( '{font-size: 14px; color: #778877}' ); $this->ofc->set_title($title); echo $this->ofc->toPrettyString(); }
/** * assign the chartdata object for open flash chart library * @param $config * @return unknown_type */ function _setChartdata($config) { $model = $this->getModel(); $rounds = $this->get('Rounds'); $round_labels = array(); foreach ($rounds as $r) { $round_labels[] = $r->name; } $division = $this->get('division'); $data = $model->getDataByDivision($division->id); //create a line $length = count($rounds) - 0.5; $linewidth = $config['color_legend_line_width']; $lines = array(); //$title = $division->name; $chart = new open_flash_chart(); //$chart->set_title( $title ); $chart->set_bg_colour($config['bg_colour']); //colors defined for ranking table lines //todo: add support for more than 2 lines foreach ($this->colors as $color) { foreach ($rounds as $r) { for ($n = $color['from']; $n <= $color['to']; $n++) { $lines[$color['color']][$n][] = $n; } } } //set lines on the graph foreach ($lines as $key => $value) { foreach ($value as $line => $key2) { $chart->add_element(hline($key, $length, $line, $linewidth)); } } //load team1, first team in the dropdown $team = $this->team1; $d = new $config['dotstyle_1'](); $d->size((int) $config['line1_dot_strength']); $d->halo_size(1); $d->colour($config['line1']); $d->tooltip('Rank: #val#'); $line = new line(); $line->set_default_dot_style($d); $line->set_values($team->rankings); $line->set_width((int) $config['line1_strength']); $line->set_key($team->name, 12); $line->set_colour($config['line1']); $line->on_show(new line_on_show($config['l_animation_1'], $config['l_cascade_1'], $config['l_delay_1'])); $chart->add_element($line); //load team2, second team in the dropdown $team = $this->team2; $d = new $config['dotstyle_2'](); $d->size((int) $config['line2_dot_strength']); $d->halo_size(1); $d->colour($config['line2']); $d->tooltip('Rank: #val#'); $line = new line(); $line->set_default_dot_style($d); $line->set_values($team->rankings); $line->set_width((int) $config['line2_strength']); $line->set_key($team->name, 12); $line->set_colour($config['line2']); $line->on_show(new line_on_show($config['l_animation_2'], $config['l_cascade_2'], $config['l_delay_2'])); $chart->add_element($line); $x = new x_axis(); if ($config['x_axis_label'] == 1) { $xlabels = new x_axis_labels(); $xlabels->set_labels($round_labels); $xlabels->set_vertical(); } $x->set_labels($xlabels); $x->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']); $chart->set_x_axis($x); $x_legend = new x_legend(JText::_('COM_JOOMLEAGUE_CURVE_ROUNDS')); $x_legend->set_style('{font-size: 15px; color: #778877}'); $chart->set_x_legend($x_legend); $y = new y_axis(); $y->set_range(count($data), 1, -1); $y->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']); $chart->set_y_axis($y); $y_legend = new y_legend(JText::_('COM_JOOMLEAGUE_CURVE_RANK')); $y_legend->set_style('{font-size: 15px; color: #778877}'); $chart->set_y_legend($y_legend); ob_clean(); echo $chart->toString(); }
} $title = new title("How far from the budget I was each month"); sort($labellist); $x_labels = new x_axis_labels(); $x_labels->rotate(45); $x_labels->set_labels($labellist); $x = new x_axis(); $x->set_labels($x_labels); $y = new y_axis(); $y->set_range(round($min) * 1.1, round($max) * 1.1); $y->set_label_text("\$#val#"); $chart = new open_flash_chart(); $chart->set_title($title); $chart->set_x_axis($x); $chart->set_y_axis($y); $chart->set_bg_colour('#FFFFFF'); foreach ($categorylist as $category) { $color = "#" . substr(md5($category), 0, 6); $default_dot = new dot(); $default_dot->size(3)->colour($color)->tooltip('#key#:<br>$#val#'); $l = new line(); $l->set_default_dot_style($default_dot); $l->set_values($datalist[$category]); $l->set_key($category, 12); $l->set_colour($color); $chart->add_element($l); } echo $chart->toPrettyString(); ?>
function _setChartdata($config) { require_once JLG_PATH_SITE . '/assets/classes/open-flash-chart/open-flash-chart.php'; $data = $this->get('ChartData'); // Calculate Values for Chart Object $forSum = array(); $againstSum = array(); $matchDayGoalsCount = array(); $round_labels = array(); foreach ($data as $rw) { if (!$rw->homegoalspd) { $rw->homegoalspd = 0; } if (!$rw->guestgoalspd) { $rw->guestgoalspd = 0; } $homeSum[] = (int) $rw->homegoalspd; $awaySum[] = (int) $rw->guestgoalspd; // check, if both results are missing and avoid drawing the flatline of "0" goals for not played games yet if (!$rw->homegoalspd && !$rw->guestgoalspd) { $matchDayGoalsCount[] = null; } else { $matchDayGoalsCount[] = (int) $rw->homegoalspd + $rw->guestgoalspd; } $round_labels[] = $rw->roundcode; } $chart = new open_flash_chart(); //$chart->set_title( $title ); $chart->set_bg_colour($config['bg_colour']); if (!empty($homeSum) && !empty($awaySum)) { if ($config['home_away_stats']) { $bar1 = new $config['bartype_1'](); $bar1->set_values($homeSum); $bar1->set_tooltip(JText::_('COM_JOOMLEAGUE_STATS_HOME') . ": #val#"); $bar1->set_colour($config['bar1']); $bar1->set_on_show(new bar_on_show($config['animation_1'], $config['cascade_1'], $config['delay_1'])); $bar1->set_key(JText::_('COM_JOOMLEAGUE_STATS_HOME'), 12); $bar2 = new $config['bartype_2'](); $bar2->set_values($awaySum); $bar2->set_tooltip(JText::_('COM_JOOMLEAGUE_STATS_AWAY') . ": #val#"); $bar2->set_colour($config['bar2']); $bar2->set_on_show(new bar_on_show($config['animation_2'], $config['cascade_2'], $config['delay_2'])); $bar2->set_key(JText::_('COM_JOOMLEAGUE_STATS_AWAY'), 12); $chart->add_element($bar1); $chart->add_element($bar2); } } // total $d = new $config['dotstyle_3'](); $d->size((int) $config['line3_dot_strength']); $d->halo_size(1); $d->colour($config['line3']); $d->tooltip(JText::_('COM_JOOMLEAGUE_STATS_TOTAL2') . ' #val#'); $line = new line(); $line->set_default_dot_style($d); $line->set_values($matchDayGoalsCount); $line->set_width((int) $config['line3_strength']); $line->set_key(JText::_('COM_JOOMLEAGUE_STATS_TOTAL'), 12); $line->set_colour($config['line3']); $line->on_show(new line_on_show($config['l_animation_3'], $config['l_cascade_3'], $config['l_delay_3'])); $chart->add_element($line); $x = new x_axis(); $x->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']); $x->set_labels_from_array($round_labels); $chart->set_x_axis($x); $x_legend = new x_legend(JText::_('COM_JOOMLEAGUE_STATS_ROUNDS')); $x_legend->set_style('{font-size: 15px; color: #778877}'); $chart->set_x_legend($x_legend); $y = new y_axis(); $y->set_range(0, @max($matchDayGoalsCount) + 2, 1); $y->set_steps(round(@max($matchDayGoalsCount) / 8)); $y->set_colours($config['y_axis_colour'], $config['y_axis_colour_inner']); $chart->set_y_axis($y); $y_legend = new y_legend(JText::_('COM_JOOMLEAGUE_STATS_GOALS')); $y_legend->set_style('{font-size: 15px; color: #778877}'); $chart->set_y_legend($y_legend); $this->chartdata = $chart; }
sort($labellist); $title = new title($bank . " Retrospective"); $cdot = new dot(); $cdot->size(3)->colour("#0000FF")->tooltip('$#val#'); $cline = new line(); $cline->set_values($cdatalist); $cline->set_colour("#0000FF"); $cline->set_default_dot_style($cdot); $cline->set_key("Checking", 12); $sdot = new dot(); $sdot->size(3)->colour("#FF0000")->tooltip('$#val#'); $sline = new line(); $sline->set_values($sdatalist); $sline->set_colour("#FF0000"); $sline->set_default_dot_style($sdot); $sline->set_key("Savings", 12); $x_labels = new x_axis_labels(); $x_labels->rotate(45); $x_labels->set_labels($labellist); $x_labels->set_steps(3); $x = new x_axis(); $x->set_labels($x_labels); $y = new y_axis(); $y->set_range(round($min) * 1.1, round($max) * 1.1); $y->set_label_text("\$#val#"); $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($cline); $chart->add_element($sline); $chart->set_x_axis($x); $chart->set_y_axis($y);
$line_sma10_default_dot = new dot(); $line_sma10_default_dot->colour('#DEA325'); $line_sma10 = new line(); $line_sma10->set_default_dot_style($line_sma10_default_dot); $line_sma10->set_values($sma10); $line_sma10->set_width(1); $line_sma10->set_colour("#DEA325"); $line_sma10->set_key("SMA10", 12); $line_sma5_default_dot = new dot(); $line_sma5_default_dot->colour('#16AAAF'); $line_sma5 = new line(); $line_sma5->set_default_dot_style($line_sma5_default_dot); $line_sma5->set_values($sma5); $line_sma5->set_width(1); $line_sma5->set_colour("#16AAAF"); $line_sma5->set_key("SMA5", 12); //print_r($data); //echo "<br /><br />"; $data = array_reverse($data); //print_r($data); $candle = new candle('#134871'); //9933CC $candle->set_values($data); $candle->set_tooltip('#x_label#<br>High: #high#<br>Open: #open#<br>Close: #close#<br>Low: #low#'); $y = new y_axis(); $range = $highest - $lowest; if ($range < 15) { $y->set_range(round($lowest - 1), round($highest + 1), 1); } else { if ($range < 100) { $y->set_range(round($lowest - 1), round($highest + 1), 5);
//$posy=0; for ($j = 0; $j < sizeof($listeJoueurs); $j++) { $type = new dot(); // if ($posy==0) $type = new dot(); // else if ($posy==1) $type = new solid_dot(); // else if ($posy==2) $type = new hollow_dot(); // else if ($posy==3) $type = new star(); // else if ($posy==4) $type = new anchor(); // else if ($posy==5) $type = new bow(); $type->tooltip($listeJoueurs[$j]['nom'] . "<br>Jeu:#x_label#<br>Moy. #val#"); $line = new line(); $line->set_default_dot_style($type); $line->set_width(1); $line->set_colour($G_MesCouleurs[$j]); $line->set_values($data_val[$j]); $line->set_key($listeJoueurs[$j]["nom"], 10); $chart->add_element($line); //$posy=$posy+1; //if ($posy==6) $posy=0; } // Tooltip du graphe ! $chart->set_tooltip($t); $fp = fopen($fichierImage, "w"); // ouverture du fichier en écriture fputs($fp, $chart->toPrettyString()); // on écrit les données fclose($fp); } echo "<div id=\"my_chart1\"> </div>"; echo "<h3>Evolution des joueurs</h3>\n"; echo "<p>Ce graphe propose une évolution de la moyenne par joueur.</p>\n";
/** * Create a single line graph * * @param string $title Title of the graph * @param array $values Array of values * @param array $titles Array of titles * @return none * */ public static function create_line_graph($title) { self::init(); $d = new solid_dot(); $d->size(3)->halo_size(1)->colour('#3D5C56'); $range_values = array(); foreach (self::$data_set as $data) { if (!is_array($data['values'])) { continue; } $line = new line(); $line->set_default_dot_style($d); $line->set_values($data['values']); $line->set_width(2); $line->set_key($data['line_title'], 10); $line->set_colour($data['color']); # Since there should be an even number on the xaxis for all sets $x_axis_titles = $data['titles']; # Add our values into a big bucket so we can get the highest and lowest $range_values = array_merge($range_values, $data['values']); self::$chart->add_element($line); } $x_labels = new x_axis_labels(); $x_labels->set_labels($x_axis_titles); $x_labels->set_vertical(); self::$x_axis->set_labels($x_labels); $range = self::get_range($range_values); self::$y_axis->set_range($range['min'], $range['max']); self::show_chart($title); }
if ($data_soll[$i] > 0) { $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);
/** * assign the chartdata object for open flash chart library * @param $config * @return unknown_type */ function _setChartdata($config) { require_once JLG_PATH_SITE . DS . "assets" . DS . "classes" . DS . "open-flash-chart" . DS . "open-flash-chart.php"; $data = $this->get('ChartData'); // Calculate Values for Chart Object $forSum = array(); $againstSum = array(); $matchDayGoalsCount = array(); $matchDayGoalsCount[] = 0; $round_labels = array(); $matchDayGoalsCountMax = 0; foreach ($data as $rw) { if (!$rw->goalsfor) { $rw->goalsfor = 0; } if (!$rw->goalsagainst) { $rw->goalsagainst = 0; } $forSum[] = intval($rw->goalsfor); $againstSum[] = intval($rw->goalsagainst); // check, if both results are missing and avoid drawing the flatline of "0" goals for not played games yet if (!$rw->goalsfor && !$rw->goalsagainst) { $matchDayGoalsCount[] = 0; } else { $matchDayGoalsCount[] = intval($rw->goalsfor + $rw->goalsagainst); } $round_labels[] = $rw->roundcode; } $chart = new open_flash_chart(); //$chart->set_title( $title ); $chart->set_bg_colour($config['bg_colour']); $barfor = new $config['bartype_1'](); $barfor->set_values($forSum); $barfor->set_tooltip(JText::_('COM_JOOMLEAGUE_TEAMSTATS_GOALS_FOR') . ": #val#"); $barfor->set_colour($config['bar1']); $barfor->set_on_show(new bar_on_show($config['animation_1'], $config['cascade_1'], $config['delay_1'])); $barfor->set_key(JText::_('COM_JOOMLEAGUE_TEAMSTATS_GOALS_FOR'), 12); $baragainst = new $config['bartype_2'](); $baragainst->set_values($againstSum); $baragainst->set_tooltip(JText::_('COM_JOOMLEAGUE_TEAMSTATS_GOALS_AGAINST') . ": #val#"); $baragainst->set_colour($config['bar2']); $baragainst->set_on_show(new bar_on_show($config['animation_2'], $config['cascade_2'], $config['delay_2'])); $baragainst->set_key(JText::_('COM_JOOMLEAGUE_TEAMSTATS_GOALS_AGAINST'), 12); $chart->add_element($barfor); $chart->add_element($baragainst); // total $d = new $config['dotstyle_3'](); $d->size((int) $config['line3_dot_strength']); $d->halo_size(1); $d->colour($config['line3']); $d->tooltip(JText::_('COM_JOOMLEAGUE_TEAMSTATS_TOTAL2') . ' #val#'); $line = new line(); $line->set_default_dot_style($d); $line->set_values(array_slice($matchDayGoalsCount, 1)); $line->set_width((int) $config['line3_strength']); $line->set_key(JText::_('COM_JOOMLEAGUE_TEAMSTATS_TOTAL'), 12); $line->set_colour($config['line3']); $line->on_show(new line_on_show($config['l_animation_3'], $config['l_cascade_3'], $config['l_delay_3'])); $chart->add_element($line); $x = new x_axis(); $x->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']); $x->set_labels_from_array($round_labels); $chart->set_x_axis($x); $x_legend = new x_legend(JText::_('COM_JOOMLEAGUE_TEAMSTATS_ROUNDS')); $x_legend->set_style('{font-size: 15px; color: #778877}'); $chart->set_x_legend($x_legend); $y = new y_axis(); $y->set_range(0, max($matchDayGoalsCount) + 2, $config['y_axis_steps']); $y->set_colours($config['y_axis_colour'], $config['y_axis_colour_inner']); $chart->set_y_axis($y); $y_legend = new y_legend(JText::_('COM_JOOMLEAGUE_TEAMSTATS_GOALS')); $y_legend->set_style('{font-size: 15px; color: #778877}'); $chart->set_y_legend($y_legend); $this->assignRef('chartdata', $chart); }