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


PHP FusionCharts::addDataSet方法代码示例

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


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

示例1:

# set the relative path of the swf file
$FC->setSwfPath("../FusionCharts/");
# Define chart attributes
$strParam = "caption=Monthly Sales;xAxisName=Number of Products;yAxisName=Revenue;numberPrefix=\$";
# Set chart attributes
$FC->setChartParams($strParam);
# Add Category, 1st parameter take label and 2nd parameter takes x axis value
# as parameter list
$FC->addCategory("0", "x=0;showVerticalLine=1");
$FC->addCategory("20", "x=20;showVerticalLine=1");
$FC->addCategory("40", "x=40;showVerticalLine=1");
$FC->addCategory("60", "x=60;showVerticalLine=1");
$FC->addCategory("80", "x=80;showVerticalLine=1");
$FC->addCategory("100", "x=100;showVerticalLine=1");
# Add a new dataset
$FC->addDataSet("Previous Month");
# Add chart data for the above dataset
# where 1st parameter for X axis value
# 2nd parameter take Y and Z axis as parameter list
# e.g y=12200;z=10
$FC->addChartData("20", "y=72000;z=8");
$FC->addChartData("43", "y=42000;z=5");
$FC->addChartData("70", "y=90000;z=2");
$FC->addChartData("90", "y=75000;z=4");
# Add another dataset
$FC->addDataSet("Current Month");
# Add chart data for the above dataset
# where 1st parameter for X axis value
# 2nd parameter take Y and Z axis as parameter list
# e.g y=12200;z=10
$FC->addChartData("18", "y=22000;z=3");
开发者ID:tyxing007,项目名称:pet-service,代码行数:31,代码来源:BubbleChart.php

示例2: FusionCharts

$FC = new FusionCharts("Scatter", "300", "250");
# set the relative path of the swf file
$FC->setSwfPath("../FusionCharts/");
# Define chart attributes
$strParam = "caption=Server Performance;yAxisName=Response Time (sec);xAxisName=Server Load (TPS)";
# Set chart attributes
$FC->setChartParams($strParam);
# Add Category, 1st parameter take label and 2nd parameter takes x axis value
# as parameter list
$FC->addCategory("10", "x=10;showVerticalLine=1");
$FC->addCategory("20", "x=20;showVerticalLine=1");
$FC->addCategory("30", "x=30;showVerticalLine=1");
$FC->addCategory("40", "x=40;showVerticalLine=1");
$FC->addCategory("50", "x=50");
# Add a new dataset
$FC->addDataSet("Server 1", "anchorRadius=6;color=880000");
# Add chart data for the above dataset
# where 1st parameter for X axis value
# 2nd parameter take Y axis as parameter list
# e.g y=27
$FC->addChartData("21", "y=2.4");
$FC->addChartData("32", "y=3.5");
$FC->addChartData("43", "y=2.5");
$FC->addChartData("48", "y=4.1");
# Add another dataset
$FC->addDataSet("Server 2", "anchorRadius=6;color=000088");
# Add chart data for the above dataset
# where 1st parameter for X axis value
# 2nd parameter take Y axis as parameter list
# e.g y=30
$FC->addChartData("23", "y=1.4");
开发者ID:bamcod,项目名称:Disease-Surveillance,代码行数:31,代码来源:Scatter_Vtrendlines.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


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