WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Simple bar graph
Categories : PHP, Charts and Graphs Click here to Update Your Picture
Potchavit Aphinives
Date : May 25th 2004
Grade : 2 of 5 (graded 4 times)
Viewed : 12782
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Potchavit Aphinives
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

When you want to compare your data among durations, the first choice is graph. This function will create a bar graph by using only tag table. If your data looks like this:
        Month 1 Growth 25%
        Month 2 Growth 20%
        Month 4 Growth 15%
        Month 7 Growth 23%
        
select all data to array:
$dnum[1]=25, $dnum[2]=20, $dnum[4]=15, $dnum[7]=23
and $allmonth=7 that means you have data until 7th month
then send variable to function graph()

<?php
$dnum
[1]=25;
$dnum[2]=20;
$dnum[4]=15;
$dnum[7]=23;
$allmonth=7;
function
graph($allmonth, $dnum) {
   
$maxdnum=ceil(max($dnum));   //find out the maximal value of array
   
if ($maxdnum>=50) { $xnum=1; }  //set scale of graph to 100%
   
elseif ($maxdnum>=20) { $xnum=2; }  //set scale of graph to 50%
   
elseif ($maxdnum>=10) { $xnum=5; }  //set scale of graph to 20%
   
elseif ($maxdnum>=5) { $xnum=10; }  //set scale of graph to 10%
   
elseif ($maxdnum>=0) { $xnum=20; }  //set scale of graph to 5%
         
   
echo "<br><table align=center width=100% border=1>";
    echo
"<tr bgcolor=cyan align=center><td>Month</td>";
    for (
$i=1; $i<=100; $i++) { echo "<td></td>"; }
    echo
"<td>%</td></tr>";
    for (
$k=1; $k<=$allmonth; $k++) {
        if ( !isset(
$dnum[$k]) ) {
           
$dnum[$k]='NA';   //set value to missed month
       
}
        echo
"<tr align=center><td>$k</td>";
        if (
$dnum[$k] !='NA') {
           
$dgraph[$k]=round($dnum[$k]*$xnum);
           
$rgraph=100-$dgraph[$k];
        }else {
           
$dgraph[$k]=0; $rgraph=100;
        }
        for (
$i=1; $i<=$dgraph[$k]; $i++) { echo "<td bgcolor=red></td>"; }
        for (
$j=1; $j<=$rgraph; $j++) { echo "<td bgcolor=#dedede></td>"; }
        echo
"<td>$dnum[$k]</td></tr>";
    }
    echo
"</table>";
}
?>


Usage Example
<?php
graph
($allmonth,$dnum);
?>




3dLib - a class for drawing in 3D space. Supported functions: Line, SetPixel, Polygon, FilledPolygon, etc. 3dChart() function has been added for one-call drawing of 3d charts. Support of mostly used 3d-transformations.
Categories : Graphics, Math., PHP Classes, PHP, Charts and Graphs
How to create charts for php using Rchart
Categories : PHP, Java, JSP, Graphics, Charts and Graphs
PHP interface class to the eBusiness Charts generatation remote service.
Categories : PHP, PHP Classes, Graphics, Charts and Graphs
Display a bar chart based on random values.
Categories : Graphics, PHP, GD image library, Charts and Graphs
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
HTML_Graphs uses PHP to provide a consistent interface for creating HTML based charts. The user of the class sets up arrays that are passed to html_graph() which then takes care of all the messy HTML layout.
Categories : Graphics, Arrays, PHP, PHP Classes, Charts and Graphs
Simple class that uses GD to draw pie charts. After the class definition there's some sample code to demonstrate how you use the class.
Categories : Graphics, PHP, PHP Classes, GD image library, Charts and Graphs
Annual Bar Chart
Categories : Graphics, PHP, Charts and Graphs
HTML_Graphs provides a simple PHP interface for creating pure HTML charts.
Categories : Graphics, PHP, PHP Classes, Charts and Graphs
a simple pie-chart in php3 (with gd)
Categories : PHP, Graphics, GD image library, Charts and Graphs
PortailPHP http://www.portailphp.com
Categories : PHP, Content Management
How to implement a session tracking system.
Categories : PHP, Sessions, Variables
Array Insertion
Categories : PHP, PHP Classes, Arrays
crop and resize image class using gd library function
Categories : PHP, PHP Classes, GD image library, Graphics
getting the name of the current script and query string
Categories : PHP, Global Variables, Variables, URLs