[PHP-DB] Graphing - bar charts

2004-04-06 Thread Craig Hoffman
Hi there:
I am looking for an open source and simple PHP script that will graph 
(bar) a few MySQL fields.  Does anyone have any recommendations?

__
Craig Hoffman - eClimb Media
v: (847) 644 - 8914
f: (847) 866 - 1946
e: [EMAIL PROTECTED]
w: www.eclimb.net
_
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Graphing - bar charts

2004-04-06 Thread jeffrey_n_Dyke



Hi there:
Hello,
I am looking for an open source and simple PHP script that will graph
(bar) a few MySQL fields.  Does anyone have any recommendations?

I'd suggest the jpgraph OO lib.  Very easy to get simple graphs up and
running.  so long as you have gd/jpeg available to your php.  With some,
not alot, more work you can start utilizing many of its features for more
complex graphs.

HTH
jeff
__
Craig Hoffman - eClimb Media

v: (847) 644 - 8914
f: (847) 866 - 1946
e: [EMAIL PROTECTED]
w: www.eclimb.net
_

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Graphing - bar charts

2004-04-06 Thread John W. Holmes
From: Craig Hoffman [EMAIL PROTECTED]

 I am looking for an open source and simple PHP script that will graph
 (bar) a few MySQL fields.  Does anyone have any recommendations?

The easiest way is to just have an image that you dynamically vary with
width of

img src=dot.jpg height=10 width=$width

Or take a look at JPGraph, which offers a lot of features.

---John Holmes...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Graphing - bar charts

2004-04-06 Thread Ignatius Reilly
jpgraph is great
http://www.aditus.nu/jpgraph/

open source, very reasonably priced

Ignatius
_
- Original Message - 
From: Craig Hoffman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 06, 2004 4:55 PM
Subject: [PHP-DB] Graphing - bar charts


 Hi there:
 I am looking for an open source and simple PHP script that will graph 
 (bar) a few MySQL fields.  Does anyone have any recommendations?
 
 __
 Craig Hoffman - eClimb Media
 
 v: (847) 644 - 8914
 f: (847) 866 - 1946
 e: [EMAIL PROTECTED]
 w: www.eclimb.net
 _
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Graphing - bar charts

2004-04-06 Thread matthew perry
Bar graphs are very easy to use with PHP.   It's just a table columns of 
varying height.

I wrote this a long time ago.  To be honest it isn't very good code and 
I think I got the ideas from someone else.
Regardless it should give you an idea.
You basically pass in an array of dollar amounts and it outputs a bar graph.
You can also manually adjust the scale of the graph by varying the 
values $minval and $maxval.
The function bar makes a single bar of the graph.
Use it at your own risk though.   It is pretty poor PHP but it did the 
trick for me!


//graph looks best when values are between 50 and 250
function bargraph ($bararray, $xminval, $xmaxval){
function bar($height,$val, $minval, $maxval){
   $n_bars=count($bararray);
   $newmargin = $maxval - $minval;
   $newdifference = $height - $minval;
   $newchange = $newdifference / $newmargin;
   $newheight = 200 * $newchange + 25;
   echo (td valign=bottom .
  table bgcolor=#aa height= . $newheight .
   cellpadding=0 cellspacing=0);
  echo(trtd align=center valign=bottom);
  echo (font color=#0 size=-1 );
  echo ($);
  printf(%.2f, $val);
  echo (/font);
  echo (/td/tr/table/td);
   }
   $n_bars=count($bararray);
   $border=0;
   echo(table bgcolor=#a0a0a0 height=200 width= .
   $n_bars*$width .  border= . $border .  );
   if (!$xminval) $minval= min ($bararray);
   else $minval = $xminval;
   if (!$xmaxval)$maxval= max ($bararray);
   else $maxval = $xmaxval;
   for ($x = 0; $xcount($bararray); $x++){
   bar($bararray[$x], $bararray[$x], $minval, $maxval);
   }
   echo(/table);
}
--
- Matt



John W. Holmes wrote:

From: Craig Hoffman [EMAIL PROTECTED]

 

I am looking for an open source and simple PHP script that will graph
(bar) a few MySQL fields.  Does anyone have any recommendations?
   

The easiest way is to just have an image that you dynamically vary with
width of
img src=dot.jpg height=10 width=$width

Or take a look at JPGraph, which offers a lot of features.

---John Holmes...