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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.