Jump to content

Help using baachart


gladiator83x

Recommended Posts

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

http://members.aol.com/barryaandrew/baaChart/baachartguide.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.





Link to comment
https://forums.phpfreaks.com/topic/15727-help-using-baachart/
Share on other sites

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();
Link to comment
https://forums.phpfreaks.com/topic/15727-help-using-baachart/#findComment-64270
Share on other sites

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

:: mychart.php ::
[code]<?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();
?>[/code]

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

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.
Link to comment
https://forums.phpfreaks.com/topic/15727-help-using-baachart/#findComment-64294
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.