Libchart PHP不会显示

时间:2014-10-14 17:38:31

标签: php mysqli

我只是想知道我的代码中的错误是什么,我首先尝试了我的查询,如果它正常工作,它确实如此。但是,当我输入代码时,图表不会显示。顺便说一句,我使用的是Libchart PHP。 提前谢谢。

<?php
    include 'libchart/libchart/classes/libchart.php';
    require '../connection/connect.php';

    header("Content-type: image/png");

    $chart = new PieChart(500, 300);
    $query = mysqli_query($con,"SELECT (SELECT COUNT(*) FROM jobseeker_reg WHERE gender='Male') AS Male, (SELECT COUNT(*) FROM jobseeker_reg WHERE gender='Female') AS Female");
    $male=$query[0]['Male'];
    $female=$query[0]['Female'];
    $dataSet = new XYDataSet();
    $dataSet->addPoint(new Point("Male", $male));
    $dataSet->addPoint(new Point("Female", $female));
    $chart->setDataSet($dataSet);

    $chart->setTitle("Number of Jobseekers (by Gender)");
    $chart->render();
?>

0 个答案:

没有答案