Jump to content


Photo

Help using baachart


  • Please log in to reply
4 replies to this topic

#1 gladiator83x

gladiator83x
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts

Posted 26 July 2006 - 06:31 PM

I downloaded this graphing class and tried the sample code located here:

http://members.aol.c...de.html#samples

However, my graphs dont show up-- I get the following errors:
-------------------------------------------------------------------
Warning: main(baaChart.php) [function.main]: failed to open stream: No such file or directory in /export/home2/webpages/baa.php on line 2

Warning: main() [function.include]: Failed opening 'baaChart.php' for inclusion (include_path='.:/usr/local/php/lib/php') in /export/home2/webpages/baa.php on line 2

Fatal error: Class 'baaChart' not found in /export/home2/webpages/baa.php on line 3
-----------------------------------------------------------------
I believe I have the gd library installed-- Is anyone familiar w/ graphing?

Also, is there anyway to put a column of dates in order in mysql?--I was looking to see if there was maybe some kind of function.







#2 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 26 July 2006 - 06:35 PM

The problem is your script can't find baachart.php, possibly because you have the Baachart class in a subfolder or your script is in the wrong folder.

<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#3 gladiator83x

gladiator83x
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts

Posted 26 July 2006 - 06:39 PM

baachart.php is the class-- the actual file has the following code:

include('baaChart.php');
$mygraph = new baaChart(600);
$mygraph->setTitle('Regional Sales','Jan - Jun 2002');
$mygraph->setXLabels("Jan,Feb,Mar,Apr,May,Jun");
$mygraph->addDataSeries('L',LINE_MARK_X,"25,30,35,40,30,35","South");
$mygraph->addDataSeries('L',LINE_MARK_CIRCLE,"65,70,80,90,75,48","North");
$mygraph->addDataSeries('L',LINE_MARK_SQUARE,"12,18,25,20,22,30","West");
$mygraph->addDataSeries('L',LINE_MARK_DIAMOND,"50,60,75,80,60,75","East");
$mygraph->addDataSeries('L',LINE_MARK_NONE,"30,45,50,55,52,60","Europe");
$mygraph->setBgColor(255,255,255,1); //Transparent
$mygraph->setXAxis("Month",1);
$mygraph->setYAxis("Sales (£000)",0,100,10,0);
$mygraph->drawGraph();


#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 26 July 2006 - 07:59 PM

Save the code in a file, say, mychart.php.

:: mychart.php ::
<?php
include('baaChart.php');
   $mygraph = new baaChart(600);
   $mygraph->setTitle('Regional Sales','Jan - Jun 2002');
   $mygraph->setXLabels("Jan,Feb,Mar,Apr,May,Jun");
   $mygraph->addDataSeries('L',LINE_MARK_X,"25,30,35,40,30,35","South");
   $mygraph->addDataSeries('L',LINE_MARK_CIRCLE,"65,70,80,90,75,48","North");
   $mygraph->addDataSeries('L',LINE_MARK_SQUARE,"12,18,25,20,22,30","West");
   $mygraph->addDataSeries('L',LINE_MARK_DIAMOND,"50,60,75,80,60,75","East");
   $mygraph->addDataSeries('L',LINE_MARK_NONE,"30,45,50,55,52,60","Europe");
   $mygraph->setBgColor(255,255,255,1); //Transparent
   $mygraph->setXAxis("Month",1);
   $mygraph->setYAxis("Sales (£000)",0,100,10,0);
   $mygraph->drawGraph();
?>

In another page, have an image tag to place the chart on the page as you would with any image file
<img src='mychart.php'>

Make sure that 'baachart.php' is in a folder defined in the "include_path" in your php.ini file. If you are on a nix system the filename will be case-sensitive so make sure the included filename matches the actual filename.
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#5 gladiator83x

gladiator83x
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts

Posted 26 July 2006 - 08:30 PM

Thanks Barand!  8)







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users