Re: [PHP-DB] Graphing - bar charts
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 ("" . ""); echo(""); echo (""); echo ("$"); printf("%.2f", $val); echo (""); echo (""); } $n_bars=count($bararray); $border=0; echo(""); if (!$xminval) $minval= min ($bararray); else $minval = $xminval; if (!$xmaxval)$maxval= max ($bararray); else $maxval = $xmaxval; for ($x = 0; $x echo(""); } -- - 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 Or take a look at JPGraph, which offers a lot of features. ---John Holmes...
Re: [PHP-DB] Graphing - bar charts
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
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 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
>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
[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