当前位置: 首页>>代码示例>>PHP>>正文


PHP FusionCharts::getXML方法代码示例

本文整理汇总了PHP中FusionCharts::getXML方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionCharts::getXML方法的具体用法?PHP FusionCharts::getXML怎么用?PHP FusionCharts::getXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FusionCharts的用法示例。


在下文中一共展示了FusionCharts::getXML方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: FusionCharts

//We creata a FusionCharts object instance
//Set chart values and configurations and retunns the XML using getXML() funciton
//and write it to the response stream to build the XML
//Here, we've kept this example very simple.
# Create column 3d chart object
$FC = new FusionCharts("column3D", "600", "300");
# Set Relative Path of swf file.
$FC->setSwfPath("../../FusionCharts/");
# Store Chart attributes in a variable
$strParam = "caption=Monthly Unit Sales;xAxisName=Month;yAxisName=Units;decimalPrecision=0; formatNumberScale=0;showNames=1";
#  Set chart attributes
$FC->setChartParams($strParam);
#add chart data values and category names
$FC->addChartData("462", "name=Jan");
$FC->addChartData("857", "name=Feb");
$FC->addChartData("671", "name=Mar");
$FC->addChartData("494", "name=Apr");
$FC->addChartData("761", "name=May");
$FC->addChartData("960", "name=Jun");
$FC->addChartData("629", "name=Jul");
$FC->addChartData("622", "name=Aug");
$FC->addChartData("376", "name=Sep");
$FC->addChartData("494", "name=Oct");
$FC->addChartData("761", "name=Nov");
$FC->addChartData("960", "name=Dec");
# get the chart XML
$strXML = $FC->getXML();
//set content type as XML
header('Content-type: text/xml');
#Return the chart XML for Column 3D Chart
print $strXML;
开发者ID:laiello,项目名称:ksu,代码行数:31,代码来源:Data.php

示例2: FusionCharts

//and write it to the response stream to build the XML
//Here, we've kept this example very simple.
# Create column 2d chart object
$FC = new FusionCharts("Column2D", "500", "400");
# Set Chart attributes
$FC->setChartParams("caption=Monthly Sales Summary;subcaption=For the year 2008;");
$FC->setChartParams("xAxisName=Month;yAxisName=Sales;numberPrefix=\$;showNames=1;");
$FC->setChartParams("showValues=0;showColumnShadow=1;animation=1;");
$FC->setChartParams("baseFontColor=666666;lineColor=FF5904;lineAlpha=85;");
$FC->setChartParams("valuePadding=10;labelDisplay=rotate;useRoundEdges=1");
#add chart data values and category names
$FC->addChartData("17400", "Label=januári");
$FC->addChartData("19800", "Label=Fevruários");
$FC->addChartData("21800", "Label=مارس");
$FC->addChartData("23800", "Label=أبريل");
$FC->addChartData("29600", "Label=五月");
$FC->addChartData("27600", "Label=六月");
$FC->addChartData("31800", "Label=תִּשׁרִי");
$FC->addChartData("39700", "Label=Marešwān");
$FC->addChartData("37800", "Label=settèmbre");
$FC->addChartData("21900", "Label=ottàgono");
$FC->addChartData("32900", "Label=novèmbre");
$FC->addChartData("39800", "Label=décembre");
# define ad apply style
$FC->defineStyle("myCaptionFont", "Font", "size=12");
$FC->applyStyle("DATALABELS", "myCaptionFont");
//set content type as XML
header('Content-type: text/xml');
#Return the chart XML for Column 3D Chart
print $FC->getXML();
开发者ID:tyxing007,项目名称:pet-service,代码行数:30,代码来源:Data.php

示例3: fs_area_graph

function fs_area_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl = '', $unit = '')
{
    global $config;
    $graph_type = "MSArea2D";
    //MSLine is possible also
    $chart = new FusionCharts($graph_type, $width, $height);
    $pixels_between_xdata = 25;
    $max_xdata_display = round($width / $pixels_between_xdata);
    $ndata = count($chart_data);
    if ($max_xdata_display > $ndata) {
        $xdata_display = $ndata;
    } else {
        $xdata_display = $max_xdata_display;
    }
    $step = round($ndata / $xdata_display);
    if (is_array(reset($chart_data))) {
        $data2 = array();
        $count = 0;
        foreach ($chart_data as $i => $values) {
            $count++;
            $show_name = '0';
            if ($count % $step == 0) {
                $show_name = '1';
            }
            if (isset($long_index[$i])) {
                $chart->addCategory($i, 'hoverText=' . $long_index[$i] . ';showName=' . $show_name);
            } else {
                $chart->addCategory($i, 'showName=' . $show_name);
            }
            $c = 0;
            foreach ($values as $i2 => $value) {
                $data2[$i2][$i] = $value;
                $c++;
            }
        }
        $data = $data2;
    } else {
        $data = array($chart_data);
    }
    $a = 0;
    $empty = 1;
    foreach ($data as $i => $value) {
        $legend_text = '';
        if (isset($legend[$i])) {
            $legend_text = $legend[$i];
        }
        $alpha = '';
        $areaBorderColor = '';
        $color = '';
        $showAreaBorder = 1;
        //0 old default
        if (isset($colors[$i])) {
            if (!isset($colors[$i]['border'])) {
                $showAreaBorder = 1;
            }
            if (isset($colors[$i]['alpha'])) {
                $alpha = 'alpha=' . $colors[$i]['alpha'] . ';';
            }
            if (isset($colors[$i]['border'])) {
                $areaBorderColor = 'areaBorderColor=' . $colors[$i]['border'] . ';';
            }
            if (isset($colors[$i]['color'])) {
                $color = 'color=#' . $colors[$i]['color'];
            }
        }
        $chart->addDataSet($legend_text, $alpha . 'showAreaBorder=' . $showAreaBorder . ';' . $areaBorderColor . $color);
        $count = 0;
        $step = 10;
        $num_vlines = 0;
        foreach ($value as $i2 => $v) {
            if ($count++ % $step == 0) {
                $show_name = '1';
                $num_vlines++;
            } else {
                $show_name = '0';
            }
            $empty = 0;
            if ($a < 3) {
                $a++;
                //			$chart->addCategory(date('G:i', $i2), //'');
                //				'hoverText=' . date (html_entity_decode ($config['date_format'], ENT_QUOTES, "UTF-8"), $i2) .
                //				';showName=' . $show_name);
            }
            //Add data
            $chart->addChartData($v);
        }
    }
    $chart->setChartParams('yAxisName=' . $unit . ';' . 'animation=0;numVDivLines=' . $num_vlines . ';showShadow=0;showAlternateVGridColor=1;showNames=1;rotateNames=1;' . 'lineThickness=0.1;anchorRadius=0.5;showValues=0;baseFontSize=9;showLimits=0;' . 'showAreaBorder=1;areaBorderThickness=0.1;areaBorderColor=000000' . ($empty == 1 ? ';yAxisMinValue=0;yAxisMaxValue=1' : ''));
    $random_number = uniqid();
    $div_id = 'chart_div_' . $random_number;
    $chart_id = 'chart_' . $random_number;
    $output = '<div id="' . $div_id . '" style="z-index:1;"></div>';
    //$output .= '<script language="JavaScript" src="include/graphs/FusionCharts/FusionCharts.js"></script>';
    $output .= '<script type="text/javascript">
			<!--
			function pie_' . $chart_id . ' () {
				var myChart = new FusionCharts("' . $homeurl . 'include/graphs/FusionCharts/FCF_' . $graph_type . '.swf", "' . $chart_id . '", "' . $width . '", "' . $height . '", "0", "1");
				myChart.setDataXML("' . addslashes($chart->getXML()) . '");
				myChart.addParam("WMode", "Transparent");
				myChart.render("' . $div_id . '");
//.........这里部分代码省略.........
开发者ID:articaST,项目名称:integriaims,代码行数:101,代码来源:functions_fsgraph.php

示例4: sum

 	$FC->setSwfPath("../../FusionCharts/");
	   
	// Store Chart attributes in a variable
	$strParam="caption=Industrie rapport de la production;subCaption=par quantité; decimalPrecision=0;showNames=1;numberSuffix= Units;pieSliceDepth=30";
	
	#  Set chart attributes
 	$FC->setChartParams($strParam);
	
    // Fetch all factory records
    $strQuery = "select a.FactoryId, a.FactoryName, sum(b.Quantity) as TotOutput from French_Factory_Master a,Factory_Output b where a.FactoryId=b.FactoryId group by a.FactoryId, a.FactoryName";
    $result = mysql_query($strQuery) or die(mysql_error());
    
    //Iterate through each factory
    if ($result) {
       // Convert Result set to FusionCharts Data     
       $FC->addDataFromDatabase($result, "TotOutput", "FactoryName");
 
    }
    //free the resultset
	mysql_free_result($result);
    mysql_close($link);

	
    //Set Proper output content-type and charset
    header('Content-type: text/xml;charset=UTF-8');
	
    //Just write out the XML data
    //NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER
?>
<?xml version='1.0' encoding='UTF-8'?><?php  echo $FC->getXML(); ?>
开发者ID:laiello,项目名称:ksu,代码行数:30,代码来源:PieDataFrench.php

示例5: generateXML

 /**
  * Function generates an xml file for generating the chart
  * 
  * @param string $sql
  * @param array $strParam
  * 
  * @return xml
  */
 function generateXML($sql, $strParam)
 {
     include "../includes/FusionCharts_Gen.php";
     $FC = new FusionCharts("Column3D", "900", "500");
     $FC->setChartParams($strParam);
     //$FC->AddColors("FF0000;00FF00;0000FF;FFFF00;FF00FF;FCAAAA");
     $obj = new Bin_Query();
     $arrdata = array();
     if ($obj->executeQuery($sql)) {
         $arr = $obj->records;
         for ($i = 0; $i < count($arr); $i++) {
             $arrdata[$i][0] = $arr[$i]['date'];
             $arrdata[$i][1] = $arr[$i]['total'];
         }
         $FC->addChartDataFromArray($arrdata);
     }
     header('Content-type: text/xml');
     $xml = $FC->getXML();
     header('Content-type: text/html');
     return $xml;
 }
开发者ID:kingsj,项目名称:zeuscart,代码行数:29,代码来源:CChart.php

示例6: FusionCharts

 function confirm_complete()
 {
     $FC = new FusionCharts();
     $totalGigs = $this->consultants->confirmGigs();
     $gigsByMonth = array();
     foreach ($totalGigs as $tg) {
         $marr = explode("-", $tg->eventDate);
         $gigsByMonth[$marr[1]][] = $tg;
     }
     $monthsArr = array("1" => "Jan", "2" => "Feb", "3" => "Mar", "4" => "Apr", "5" => "May", "6" => "Jun", "7" => "Jul", "8" => "Aug", "9" => "Sep", "10" => "Oct", "11" => "Nov", "12" => "Dec");
     // specify the graph parameters
     $strParam = "caption=Total Gigs- Monthly ;xAxisName=Month;yAxisName=Total gigs;decimalPrecision=0;formatNumberScale=1";
     $FC->setChartParams($strParam);
     for ($i = 1; $i <= 12; $i++) {
         $total = isset($gigsByMonth[$i]) ? count($gigsByMonth[$i]) : 0;
         $FC->addChartData($total, "name=" . $monthsArr[$i]);
     }
     print $FC->getXML();
 }
开发者ID:benoastler,项目名称:Clubband,代码行数:19,代码来源:charts.php


注:本文中的FusionCharts::getXML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。