0

嗨,我正在尝试使用 pchart 库,但我在 CentOS vps 中得到了一些与我的 Windows 服务器机器不同的奇怪结果。

该代码是一个示例和基本代码,例如

 /*
 Naked: Naked and easy!

 */


 // Standard inclusions   

 include("pChart/pData.class");

 include("pChart/pChart.class");


 // Dataset definition 

 $DataSet = new pData;

 $DataSet->AddPoint(array(1,4,3,2,3,3,2,1,0,7,4,3,2,3,3,5,1,0,7));

 $DataSet->AddSerie();

$DataSet->SetSerieName("Sample data","Serie1");


// Initialise the graph

$Test = new pChart(700,230);

 $Test->setFontProperties("Fonts/tahoma.ttf",10);

$Test->setGraphArea(40,30,680,200);

$Test->drawGraphArea(252,252,252,TRUE);




$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2);

$Test->drawGrid(4,TRUE,230,230,230,70);


// Draw the line graph

$Test->drawLineGraph($DataSet->GetData(),$DataSet->GetDataDescription());


$Test->drawPlotGraph($DataSet->GetData(),$DataSet->GetDataDescription(),3,2,255,255,255);


// Finish the graph

$Test->setFontProperties("Fonts/tahoma.ttf",8);

$Test->drawLegend(45,35,$DataSet->GetDataDescription(),255,255,255);

$Test->setFontProperties("Fonts/tahoma.ttf",10);

$Test->drawTitle(60,22,"My pretty graph",50,50,50,585);

$Test->Render("Naked.png");

?>

windows中生成的图像是赢

相同代码在 CentOS VPS 中的结果是力克斯

我认为这可能与 php_gd2.dll 的版本或其他东西有关。这是我正在使用的 pchart版本

4

1 回答 1

0

这似乎是一个字体问题,因为我能看到的唯一区别是它缺少文本。如果没有安装 CentOS,我无法对此进行测试,尽管我会尝试使用该drawTitle($X,$Y,$Text,$Format="")函数制作一个简单的图形,以及 CentOS 中的一些不同字体。

于 2012-02-01T00:18:03.903 回答