从另一个php文件调用的PHP libchart部分工作

时间:2014-12-07 20:20:21

标签: php charts

我只是尝试直接调用libchart示例文件(添加了一些测试显示)(Display 6& Graph)。

<?php
        echo "Display 1";
        include "../libchart/classes/libchart.php";
    echo "Display 1";
    include "../libchart/classes/libchart.php";
    echo "Display 2";

    $chart = new VerticalBarChart();
    echo "Display 3";

    $dataSet = new XYDataSet();
    echo "Display 4";
    $dataSet->addPoint(new Point("Jan 2005", 273));
    $dataSet->addPoint(new Point("Feb 2005", 421));
    $dataSet->addPoint(new Point("March 2005", 642));
    $dataSet->addPoint(new Point("April 2005", 800));
    $dataSet->addPoint(new Point("May 2005", 1200));
    $dataSet->addPoint(new Point("June 2005", 1500));
    $dataSet->addPoint(new Point("July 2005", 2600));
    $dataSet->addPoint(new Point("Aug 2005", 600));
    $chart->setDataSet($dataSet);
    echo "Display 5";
    //echo "Hello";
    $chart->setTitle("Monthly usage of www.example.com");
    $chart->render("generated/demo112.png");
    echo "Display 6";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--<html xmlns="http://www.w3.org/1999/xhtml">-->
<html>
<head>
        <title>Libchart vertical bars demonstration</title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
</head>
<body>
        <img alt="Vertical bars chart" src="generated/demo112.png" style="border: 1px solid gray;"/>
</body>
</html>

然后尝试从另一个php文件调用,它运行正常(显示6&amp;图形)。

<?php
include'VerticalBarChartTest.php';
?>

但是当我从另一个功能性php文件中尝试时,只显示了显示1和2,并且不会进一步移动。可能是什么问题?

<?php
many logic...
include'VerticalBarChartTest.php';
?>

我的逻辑是正确的,当我评论包含文件时,我的逻辑工作正常。 当我包含此VerticalBarChartTest.php文件调用时,它会挂起显示2消息。

0 个答案:

没有答案