pChart 2.x forum
http://wiki.pchart.net/forum/

installation and sample chart problem
http://wiki.pchart.net/forum/viewtopic.php?f=1&t=2303
Page 1 of 1

Author:  stephk [ Mon Dec 12, 2011 12:17 pm ]
Post subject:  installation and sample chart problem

Hi,

I am very new with pChart, and not really good in Php :) I tryed to install pChart but and print a simple chart in a simple test php page.
my problem is that it seems that when i include the .class.php files, it doesnt work.

Code:
<?php
echo test1;
if ((include 'localhost/website/lib/pChart/class/pDraw.class.php') == 'OK') {
    echo OK;
}

echo test2;
include("//localhost/website/lib/pChart/class/pDraw.class.php");
include("//localhost/website/lib/pChart/class/pImage.class.php");
include("//localhost/website/lib/pChart/class/pData.class.php");

echo test3;

$myDataset = array(0, 1, 1, 2, 3, 5, 8, 13);

echo test4;

$myData = new pData();

echo test5;

$myData->addPoints($myDataset);

echo test6;

$myImage = new pImage(500, 300, $myData);

echo test7;

$myImage->setFontProperties(array(
    "FontName" => PCHART_PATH . "/fonts/GeosansLight.ttf",
    "FontSize" => 15));


$myImage->setGraphArea(25,25, 475,275);
$myImage->drawScale();   
$myImage->drawBarChart();
header("Content-Type: image/png");
$myImage->Render(null);

echo test12;
?>



I put some echo each lines to see where it do not work and it seems to block at the "new pData" and the include does not seems to work as the following code doesnt print OK,
Quote:
if ((include 'localhost/website/lib/pChart/class/pDraw.class.php') == 'OK') {
echo OK;
}


Can someone explain me what is my problem or how to solve it that should be very simple... the library GD is enable.
Thank you.

Author:  wildwalks [ Mon Dec 12, 2011 1:46 pm ]
Post subject:  Re: installation and sample chart problem

The include needs to be for your disk - not Http: request path
this path looks weird
## include 'localhost/website/lib/pChart/class/pDraw.class.php'

more likley something like (assuming linux server)
include '/var/www/website/lib/pChart/class/pDraw.class.php'

If that does not help. put something like
error_reporting(E_ALL);
ini_set('display_errors', '1');
at the beginning of your file and you will probably work it out from the error messages.

Hopefully that helps.

Matt :)

Author:  stephk [ Mon Dec 12, 2011 2:07 pm ]
Post subject:  Re: installation and sample chart problem

Thx for your rapid answer!

One thing that i don't understand, like if a path for the include on my local disk, how will it gets it once my website on the online server? sorry it looks dumb question.. :)

Could you show me a path exemple for windows.

Doing what you told, in the relevent errors i had this one:
Quote:
Warning: include(): Failed opening 'class/pDraw.class.php' for inclusion (include_path='.;C:\php\pear') in C:\Inetpub\wwwroot\website\test.php on line 9


Another idiot question, the folder of pChart unzipped has to be in the Php folder??

Thank you again for your help.

Steph

Author:  stephk [ Mon Dec 12, 2011 2:12 pm ]
Post subject:  Re: installation and sample chart problem

Quote:
Warning: include(../wwwroot/website/lib/pChart/class/pDraw.class.php): failed to open stream: No such file or directory in C:\Inetpub\wwwroot\website\test.php

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/