• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

jpgraph图表使用引出类 就无法输出图表

php 搞代码 4年前 (2022-01-24) 19次浏览 已收录 0个评论

jpgraph图表使用引入类 就无法输出图表

本帖最后由 h9zhou 于 2014-05-12 15:31:35 编辑

jpgraph图表使用问题,在显示图表的php文件一引入类 ,就无法输出图表,图表就变成一个叉,是jpgraph不支持吗

在问个问题 jp%本文@来源gao@!dai!ma.com搞$$代^@码!网搞代gaodaima码graph 这东西要不要学,实际用的多吗?

<?php // content="text/plain; charset=utf-8"<br />require_once ('SqlHelper.class.php');//这是我写的类,用于操作数据库,但是一引入就出错<br />require_once ('jpgraph/jpgraph.php');<br />require_once ('jpgraph/jpgraph_bar.php');<br /><br /><br />$datay1=array(12,12,15);<br />$datay2=array(0,0,0);<br /><br />// Create the graph.<br />$graph = new Graph(350,250);<br />$graph->SetScale('textlin');<br />$graph->SetMarginColor('silver');<br /><br /><br />// Setup title<br />$str="";<br />$id=$_REQUEST['id'];<br />if($id==1){<br />	$str="支持布什的情况统计图";<br />}else if($id==2) {<br />	$str="支持奥巴马的情况统计图";<br />}<br />$graph->title->Set($str);<br />$graph->title->setFont(FF_SIMSUN,FS_BOLD,14);<br />// Create the first bar<br />$bplot = new BarPlot($datay1);<br />$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT);<br />$bplot->SetColor('darkred');<br /><br />// Create the second bar<br />$bplot2 = new BarPlot($datay2);<br />$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT);<br />$bplot2->SetColor('darkgreen');<br /><br />// And join them in an accumulated bar<br />$accbplot = new AccBarPlot(array($bplot,$bplot2));<br />$graph->Add($accbplot);<br /><br />$graph->Stroke();<br />?><br />

——解决方案——————–
去掉所有相关文件的 BOM 头 和 <?php 之前的空格换行


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:jpgraph图表使用引出类 就无法输出图表
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址