Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为什么pchart图表不呈现?我已经安装了gd2_Php_Function_Wampserver_Pchart - Fatal编程技术网

Php 为什么pchart图表不呈现?我已经安装了gd2

Php 为什么pchart图表不呈现?我已经安装了gd2,php,function,wampserver,pchart,Php,Function,Wampserver,Pchart,我正在尝试将图表集成到网站中。我通过查看示例测试了gd2安装,这些示例是有效的。然后我继续将其集成到我的php文件中,使用以下代码: include("grafice/class/pData.class.php"); include("grafice/class/pDraw.class.php"); include("grafice/class/pImage.class.php"); //creaza si populeaza obiectul $MyData = new pDat

我正在尝试将图表集成到网站中。我通过查看示例测试了gd2安装,这些示例是有效的。然后我继续将其集成到我的php文件中,使用以下代码:

 include("grafice/class/pData.class.php");
 include("grafice/class/pDraw.class.php");
 include("grafice/class/pImage.class.php");

  //creaza si populeaza obiectul
 $MyData = new pData();  
 $MyData->addPoints(array(4,VOID,VOID,10,8,3),"Proba 1");
 $MyData->addPoints(array(3,10,5,8,5,5),"Proba 2");
 $MyData->addPoints(array(2,7,5,1,9,2),"Proba 3");
 $MyData->setSerieTicks("Proba 2",4);
 $MyData->setSerieWeight("Proba 3",2);
 $MyData->setAxisName(0,"Note");
 $MyData->addPoints(array("Ian","Feb","Mar","Apr","Mai","Iun"),"Labels");
 $MyData->setSerieDescription("Labels","Luni");
 $MyData->setAbscissa("Labels");

 // creaza obiectul chart
 $myPicture = new pImage(700,230,$MyData);


 //deseneaza fundalul
 $Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
 $myPicture->drawFilledRectangle(0,0,700,230,$Settings);

 // suprapune un gradient
 $Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
 $myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings);
 $myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80));

 // bordura
 $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));

 // titlul pozei
 $myPicture->setFontProperties(array("FontName"=>"fonts/Silkscreen.ttf","FontSize"=>6));
 $myPicture->drawText(10,13,"EXEMPLU",array("R"=>255,"G"=>255,"B"=>255));

 // titlul graficului 
 $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>11));
 $myPicture->drawText(250,55,"Media Notelor",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));

 //deseneaza marimea 1 
 $myPicture->setGraphArea(60,60,450,190);
 $myPicture->drawFilledRectangle(60,60,450,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));

 $AxisBoundaries = array(0=>array("Min"=>0,"Max"=>10));
 $scaleSettings  = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,"Mode"=>SCALE_MODE_MANUAL, "ManualScale"=>$AxisBoundaries);

$myPicture->drawScale($scaleSettings);
 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
 $myPicture->setFontProperties(array("FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6));
 $myPicture->drawLineChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO));
 $myPicture->setShadow(FALSE);

 //deseneaza marimea 2 
 $myPicture->setGraphArea(500,60,670,190);
 $myPicture->drawFilledRectangle(500,60,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
 $myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM,"DrawSubTicks"=>TRUE));
 $myPicture->setShadow(TRUE,array("X"=>-1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
 $myPicture->drawLineChart();
 $myPicture->setShadow(FALSE);

 // deseneaza legenda
 $myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));

 //rendereaza poza
 $myPicture->autoOutput("img/example.drawLineChart.png");
不幸的是,这使得整个页面呈现如下:(我正在上传一张图片,因为你需要一个帐户才能看到它)

我做错什么了吗?我在函数中使用了这段代码


而且,在WAMP示例中,这不起作用。有什么办法吗?

我设法做到了,并在这里发布了帮助他人的帖子

所以,我做了这个函数,但我编辑了粗体部分

function grafice()
{     
/* pChart library inclusions */
include("../class/pData.class.php");
include("../class/pDraw.class.php");
include("../class/pImage.class.php");


/* Create and populate the pData object */

$MyData = new pData();  

$MyData->addPoints(array(10,5,7,8), "Probe 1");


$MyData->setSerieWeight("Probe 1",2);

$MyData->setAxisName(0,"Media Generala");

$MyData->addPoints(array("Ian","Feb","Mar","Apr","Mai","Iun"),"Labels");

$MyData->setSerieDescription("Labels","Luni");

$MyData->setAbscissa("Labels");
 $serieSettings = array("R"=>255,"G"=>185,"B"=>11);
 $MyData->setPalette("Probe 1",$serieSettings);


/* Create the pChart object */

$myPicture = new pImage(500,230,$MyData);



/* Draw the background */

$Settings = array("R"=>248, "G"=>226, "B"=>174, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);

$myPicture->drawFilledRectangle(0,0,700,230,$Settings);



/* Overlay with a gradient */

$Settings = array("StartR"=>238, "StartG"=>216, "StartB"=>174, "EndR"=>238, "EndG"=>216, "EndB"=>174, "Alpha"=>50);

$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings);

$myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80));



/* Add a border to the picture */

$myPicture->drawRectangle(0,0,499,229,array("R"=>0,"G"=>0,"B"=>0));



/* Write the picture title */ 

$myPicture->setFontProperties(array("FontName"=>"../fonts/Silkscreen.ttf","FontSize"=>6));

$myPicture->drawText(10,13,"Evolutia Mediei Generale",array("R"=>255,"G"=>255,"B"=>255));



/* Write the chart title */ 

$myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>11));

$myPicture->drawText(250,55,"Media Generala",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));



/* Draw the scale and the 1st chart */

$AxisBoundaries = array(0=>array("Min"=>0,"Max"=>10));
$scaleSettings  = array("DrawSubTicks"=>TRUE,"Mode"=>SCALE_MODE_MANUAL, "ManualScale"=>$AxisBoundaries);

$myPicture->setGraphArea(60,60,450,190);

$myPicture->drawFilledRectangle(60,60,450,190,array("R"=>0,"G"=>0,"B"=>0,"Surrounding"=>-200,"Alpha"=>10));

$myPicture->drawScale($scaleSettings);

$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));

$myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>10,"R"=>0,"G"=>0,"B"=>0));

$myPicture->drawLineChart(array("DisplayValues"=>TRUE,"DisplayR"=>0, "DisplayG"=>0, "DisplayB"=>0, "DisplayOffset"=>10));

$myPicture->setShadow(FALSE);




/* Render the picture (choose the best way) */

/* $myPicture->**( I DELETED ThIS)--> autoOutput <---** ("pictures/example.drawLineChart.png"); and added */

 $myPicture->render("pictures/example.drawLineChart.png");


}
function-grafice()
{     
/*pChart库包含*/
包括(“../class/pData.class.php”);
包括(“../class/pDraw.class.php”);
包括(“../class/pImage.class.php”);
/*创建并填充pData对象*/
$MyData=new pData();
$MyData->addPoints(数组(10,5,7,8),“探针1”);
$MyData->setSerieWeight(“探头1”,2);
$MyData->setAxisName(0,“媒体常规”);
$MyData->addPoints(数组(“Ian”、“Feb”、“Mar”、“Apr”、“Mai”、“Iun”)、“Labels”);
$MyData->setSerieDescription(“标签”、“Luni”);
$MyData->setAbscissa(“标签”);
$serieSettings=数组(“R”=>255,“G”=>185,“B”=>11);
$MyData->setPalette(“探测1”,“系列设置”);
/*创建pChart对象*/
$myPicture=new pImage(500230$MyData);
/*画背景*/
$Settings=数组(“R”=>248,“G”=>226,“B”=>174,“破折号”=>1,“破折号”=>190,“破折号”=>203,“破折号”=>107);
$myPicture->drawFilledRectangle(0,0700230,$Settings);
/*用渐变覆盖*/
$Settings=数组(“StartR”=>238,“StartG”=>216,“StartB”=>174,“EndR”=>238,“EndG”=>216,“EndB”=>174,“Alpha”=>50);
$myPicture->drawGradientArea(0,0700230,方向垂直,$Settings);
$myPicture->drawGradientArea(0,0700,20,方向垂直,阵列(“StartR”=>0,“StartG”=>0,“StartB”=>0,“EndR”=>50,“EndG”=>50,“EndB”=>50,“Alpha”=>80));
/*为图片添加边框*/
$myPicture->drawRectangle(0,0499229,数组(“R”=>0,“G”=>0,“B”=>0));
/*写下图片标题*/
$myPicture->setFontProperties(数组(“FontName”=>”./fonts/Silkscreen.ttf,“FontSize”=>6));
$myPicture->drawText(10,13,“Evolutia Mediei Generale”,数组(“R”=>255,“G”=>255,“B”=>255));
/*写下图表标题*/
$myPicture->setFontProperties(数组(“FontName”=>”./fonts/Forgotte.ttf,“FontSize”=>11));
$myPicture->drawText(250,55,“媒体通用”,数组(“FontSize”=>20,“Align”=>TEXT\u Align\u BOTTOMMIDDLE));
/*绘制比例和第一张图表*/
$AxisBounders=array(0=>array(“最小”=>0,“最大”=>10));
$scaleSettings=array(“DrawSubTicks”=>TRUE,“Mode”=>SCALE\u Mode\u MANUAL,“ManualScale”=>$AxisBounders);
$myPicture->setGraphArea(60,60450190);
$myPicture->drawFilledRectangle(60,60450190,数组(“R”=>0,“G”=>0,”B”=>0,“环绕”=>200,“Alpha”=>10));
$myPicture->drawScale($scaleSettings);
$myPicture->setShadow(真,数组(“X”=>1,“Y”=>1,“R”=>0,“G”=>0,“B”=>0,“Alpha”=>10));
$myPicture->setFontProperties(数组(“FontName”=>”./fonts/pf_arma_five.ttf、“FontSize”=>10,“R”=>0,“G”=>0,“B”=>0));
$myPicture->drawLineChart(数组(“DisplayValues”=>TRUE,“displayer”=>0,“DisplayG”=>0,“DisplayB”=>0,“DisplayOffset”=>10));
$myPicture->setShadow(FALSE);
/*渲染图片(选择最佳方式)*/
/*$myPicture->**(我删除了它)-->自动输出渲染(“pictures/example.drawLineChart.png”);
}
然后,当我想叫它的时候,就像这样:

<?php grafice(); ?>

然后我可以做:

<img src="pictures/example.drawLineChart.png" />


现在我只需使用会话id更改图片名称,这样每个人都会有一个不同的图形;)希望这将有助于某人

PHP错误日志中有什么?没有。它是空的!错误报告正在进行吗?谢谢你的回复。很抱歉,我通过渲染图像,然后将其显示为