* @package report * @version $Id$ * @link http://www.zentao.net */ ?> app->getWebRoot() . 'fusioncharts/'; $swfFile = "fcf_$swf.swf"; return << EOT; } /** * Create the js code of chart. * * @param string $swf the swf type * @param string $dataURL the date url * @param int $width * @param int $height * @access public * @return string */ public function createJSChart($swf, $dataXML, $width = 'auto', $height = 500) { $jsRoot = $this->app->getWebRoot() . 'js/'; static $count = 0; $count ++; $chartRoot = $this->app->getWebRoot() . 'fusioncharts/'; $swfFile = "fcf_$swf.swf"; $divID = "chart{$count}div"; $chartID = "chart{$count}"; $js = ''; if($count == 1) $js = ""; return << EOT; } /** * Create xml data of single charts. * * @param array $sets * @param array $chartOptions * @param array $colors * @access public * @return string the xml data. */ public function createSingleXML($sets, $chartOptions = array(), $colors = array()) { $data = pack("CCC", 0xef, 0xbb, 0xbf); // utf-8 bom. $data .=""; $data .= ' $value) $data .= " $key='$value'"; $data .= ">"; if(empty($colors)) $colors = $this->lang->report->colors; $colorCount = count($colors); $i = 0; foreach($sets as $set) { if($i == $colorCount) $i = 0; $color = $colors[$i]; $i ++; $data .= ""; } $data .= ""; return $data; } /** * Create the js code to render chart. * * @param int $chartCount * @access public * @return string */ public function renderJsCharts($chartCount) { $js = ''; return $js; } /** * Compute percent of every item. * * @param array $datas * @access public * @return array */ public function computePercent($datas) { $sum = 0; foreach($datas as $data) $sum += $data->value; foreach($datas as $data) $data->percent = round($data->value / $sum, 2); return $datas; } }