Php 有了pChart,我可以';t用少于4个值绘制条形图
下面使用的代码可以正常工作,但是如果我将序列更改为小于4个值,我就不会返回任何内容,页面只会继续加载! 要重现问题,只需取出系列的最后数字: 系列1的阵列(9,9,9)和系列3的阵列(4,5,6)Php 有了pChart,我可以';t用少于4个值绘制条形图,php,pchart,Php,Pchart,下面使用的代码可以正常工作,但是如果我将序列更改为小于4个值,我就不会返回任何内容,页面只会继续加载! 要重现问题,只需取出系列的最后数字: 系列1的阵列(9,9,9)和系列3的阵列(4,5,6) <?php // Standard inclusions include("pChart/pData.class"); include("pChart/pChart.class"); // Dataset definition $DataSet = ne
<?php
// Standard inclusions
include("pChart/pData.class");
include("pChart/pChart.class");
// Dataset definition
$DataSet = new pData;
$DataSet->AddPoint(array(9,9,9,10),"Serie1");
$DataSet->AddPoint(array(4,5,6,7),"Serie3");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Serie3");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("January","Serie1");
$DataSet->SetYAxisName("Temperature");
$DataSet->SetYAxisUnit("°C");
$DataSet->SetXAxisUnit("h");
// Initialise the graph
$Test = new pChart(350,230);
$Test->setGraphArea(10,20,240,220);
$Test->drawGraphArea(213,217,221,FALSE);
$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,213,217,221,TRUE,0,2,TRUE);
// Draw the bar chart
$Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription(),70);
// Render the picture
$Test->Stroke();
?>
我用pChart 1.27d替换了pChart库版本1.27b。这解决了问题。
所以这是旧库中的一个bug。我在这里试过,效果很好。你确定没有其他问题吗?你能告诉我你正在使用哪个版本的库吗?