急提示JpGraph Error A plot has an illegal scale. 。解決思路

來源:互聯網
上載者:User
急急急,提示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'),My Code如下。就是標註的地方修改,其他地方原封不動抄的例子


$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);
你是說這個樣子不行?
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.