| AND OR | string words | *

html and code

|

simple bar chart

| see demonstration of simple bar chart


this simple bar chart doesn't require any image manipulation software on the server.
it's done only in html and uses percentages in tables to show the chart.



full source of simple bar chart [ line 1 - 32 ] | download simple bar chart

1    <?php
2   // total width
3   $total_width 600;
4   // base color
5   $base_color 'silver';
6   // add an array per field to show
7   $graphs array(
8   array('label'=>'whatever''color'=>'red''amount'=>'30'),
9   array('label'=>'more here''color'=>'green''amount'=>'36'),
10   array('label'=>'just an example''color'=>'blue''amount'=>'82'),
11   array('label'=>'even more''color'=>'orange''amount'=>'4'),
12   );
13   for($x 0$x count($graphs); $x++)
14   {
15       echo '
16   <table width="'.$total_width.'">
17       <tr>
18           <td colspan="2">
19               '.$graphs[$x]['label'].'
20           </td>
21       </tr>
22       <tr>
23           <td width="'.$graphs[$x]['amount'].'%" bgcolor="'.$graphs[$x]['color'].'">
24               '.$graphs[$x]['amount'].'%
25           </td>
26           <td width="'.(100-$graphs[$x]['amount']).'%" bgcolor="'.$base_color.'">
27               &nbsp;
28           </td>
29       </tr>
30   </table>';
31   }
32   ?>



20 hits by 11 users in the last 30 minutes.