Hi,

I'm new to this producing php graphs, I have this file (libchart.php)

require_once 'charts/classes/model/Point.php';
	require_once 'charts/classes/model/DataSet.php';
	require_once 'charts/classes/model/XYDataSet.php';
	require_once 'charts/classes/model/XYSeriesDataSet.php';

require_once 'charts/classes/view/primitive/Padding.php';
require_once 'charts/classes/view/primitive/Rectangle.php';
require_once 'charts/classes/view/primitive/Primitive.php';
require_once 'charts/classes/view/text/Text.php';
require_once 'charts/classes/view/color/Color.php';
require_once 'charts/classes/view/color/ColorSet.php';
require_once 'charts/classes/view/color/Palette.php';
require_once 'charts/classes/view/axis/Bound.php';
require_once 'charts/classes/view/axis/Axis.php';
require_once 'charts/classes/view/plot/Plot.php';
require_once 'charts/classes/view/caption/Caption.php';
require_once 'charts/classes/view/chart/Chart.php';
require_once 'charts/classes/view/chart/BarChart.php';
require_once 'charts/classes/view/chart/VerticalBarChart.php';
require_once 'charts/classes/view/chart/HorizontalBarChart.php';
require_once 'charts/classes/view/chart/LineChart.php';
require_once 'charts/classes/view/chart/PieChart.php';

and this one (producegraph.php):

include "charts/classes/libchart.php";

$chart = new VerticalBarChart(500, 250);

$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("Jan 2005", 273));
$dataSet->addPoint(new Point("Feb 2005", 321));
$dataSet->addPoint(new Point("March 2005", 442));
$dataSet->addPoint(new Point("April 2005", 711));

$chart->setDataSet($dataSet);

$chart->setTitle("Monthly usage for www.example.com");
$chart->render("charts/classes/generated/demo1.png");

However when i upload producegraph.php I just get a blank page any reason why please?

Hope someone can help here.

Thanks.

    Not being familiar with that package, all I can suggest is the usual debugging options:

    Make sure all error reporting is turned on or check the PHP error log file.

    Check all return values for unexpected results and output error notices if so.

    Use [man]var_dump/man to inspect various input/output values, return values, etc. to see what's happening within the code.

      The script just produces the graph and saves it to a file.
      You need to have some html to display it.
      <img src='charts/classes/generated/demo1.png' >

        Unfortunately I have checked the generated folder and there is nothing in it. Hiw do I actually get it to render the image in the folder?

          You need to make sure that the folder you specified the image to be saved to has the correct permissions. It should be 777 (allow all to read, write and execute)

            4 days later

            Yes the folder has the correct permissions now but it's still empty when i run the script. Any ideas!?!?!

            <?php
            include "charts/classes/libchart.php";
            $chart = new VerticalBarChart(500, 250);
            
            $dataSet = new XYDataSet();
            $dataSet->addPoint(new Point("Jan 2005", 273));
            $dataSet->addPoint(new Point("Feb 2005", 321));
            $dataSet->addPoint(new Point("March 2005", 442));
            $dataSet->addPoint(new Point("April 2005", 711));
            $chart->setDataSet($dataSet);
            $chart->setTitle("Monthly usage for www.example.com");
            $chart->render("charts/generated/demo1.png");
            ?>
            

              I have spoken to the company who look after our sites and they have told me that that folder is definately writeable so why woiuld I be having this problem has anyone used this libchart before?

                Write a Reply...