日期:2014-05-17  浏览次数:20454 次

急急急,提示JpGraph Error A plot has an illegal scale. 。。。。
我把x y轴的数据用数据库的数据,但报错,提示JpGraph Error A plot has an illegal scale. This could for example be that you are trying to use text auto scaling to draw a line plot with only one point or that the plot area is too small. It could also be that no input data value is numeric (perhaps only '-' or 'x'),我的代码如下。就是标注的地方修改,其他地方原封不动抄的例子


$data = $cny; //Y轴红线数据数组, $cny 是数据:1,25
$lbl = $cnx; //x轴数据 $cny 是日期 09-01,09-28

//////////////////////下面跟例子一样///

$graph = new Graph(1028 ,500); //创建新的Graph对象,图片长:400px,宽300px

$graph->SetScale("textlin"); //设置刻度模式

$graph->img->SetMargin(30 , 30 , 80 , 30) ; //设置图表边界

$graph->title->Set("**银行订单走势图") ; //设置图表标题

$graph->title->SetFont(FF_SIMSUN,FS_BOLD); // 设置标题中文字体
$graph->legend->SetFont(FF_SIMSUN,FS_BOLD); //设置线条指示字体

$lineplot = new LinePlot($data); //创建新的LinePlot对象

$lineplot->SetLegend("红线");//设置图例文字


$lineplot->SetColor("red"); //设置曲线颜色

$graph->xaxis->SetTickLabels($lbl); //配置x轴坐标


$graph->Add($lineplot); //在统计图上绘制曲线


------解决方案--------------------
不是很清楚你的问题。
$data = $cny; 
$lbl = $cnx; 

是这两个值引起的问题?那你和原来使用的值比较一下呗,看看类型什么的,是否有不同。
------解决方案--------------------
有点怪,哈哈
哪有不支持变量的?
$cny = array(2,4,7);
你是说这个样子不行?