doujuanju3076 2019-04-03 07:58 采纳率: 0%
浏览 74

无法显示图像“http:// localhost / KVL / showgraph”,因为它包含错误 - Jpgraph

I am using PHP Jpgraph library to create a graph from arrays generated from a mysql query.

I have written this php code:

require_once('jpgraph/src/jpgraph.php');
require_once('jpgraph/src/jpgraph_bar.php'); 

foreach ($results as $key => $value){

$data[] = $value['num_rows'];//$data = array(740,902,647,208);
$data1[] = $value['department_name'];//$data1 = array('Epi', 'Dss', 'Bio', 'Clin');


}

 $graph = new Graph(450,200,"auto");
 $graph->SetScale("textlin");
 $graph->img->SetMargin(40,30,40,40);

 $graph->SetShadow();

  $graph->xaxis->SetTickLabels($data1);

  $bplot = new BarPlot($data);
  $bplot->SetFillColor("lightgreen"); 
  $bplot->value->Show();
  $bplot->value->SetFont(FF_ARIAL,FS_BOLD);
  $bplot->value->SetAngle(45);
  $bplot->value->SetColor("black","navy");

  $graph->Add($bplot);
  $graph->Stroke();

I expect a bargraph generated by jpgraph. However, i get a blank page with a message "The image 'http://localhost/KVL/showgraph" cannot be displayed because it contains errors. I have run php -m on my terminal and can see that GD extension is installed. I am running php 7.2.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度