Home  >  Article  >  Backend Development  >  pChart库的使用请问

pChart库的使用请问

WBOY
WBOYOriginal
2016-06-13 11:04:571016browse

pChart库的使用请教

 include("pChart/pData.class"); //数据类
include("pChart/pChart.class"); //画图类

//准备好画图的数据
$arr1 = array(1225.48,627.65); // 对应数据
$arr2 = iconv_arr(array('直营','加盟',)); //数据的文字,和数据位置对应,这里也用了iconv_arr转换中文

//第一步 获得饼图数据
$data = new pdata;
$data->AddPoint($arr1,"serie1"); //装入数据并命名为serie1
$data->AddPoint($arr2,"serie2"); //装入说明并命名为serie2
$data->AddAllSeries(); //提交数据
$data->SetAbsciseLabelSerie("serie2"); //设置标签



为什么我把  $arr1  $arr2直接等于一个SQL查询出来的数组就有问题了呢?数据提交就好像直接到了最后一条。

while($row1=mssql_fetch_assoc($result1)){;
//准备好画图的数据
$arr1 = round($row1['XX1']); // 对应数据
$arr2 = iconv_arr($row1['XX2']); //数据的文字,和数据位置对应,这里也用了iconv_arr转换中文
//第一步 获得饼图数据
$data = new pdata;
$data->AddPoint($arr1,"serie1"); //装入数据并命名为serie1
$data->AddPoint($arr2,"serie2"); //装入说明并命名为serie2
$data->AddAllSeries(); //提交数据
$data->SetAbsciseLabelSerie("serie2"); //设置标签
echo $arr1;
//echo $arr2."
";



结果就会是一条信息.饼也是100%。。 不知道为什么数据提交的不对。
------解决方案--------------------
你的echo有没有把所有需要的数据echo出来?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn