[ PHPXref.com ] [ Generated: Sun Jul 20 19:19:23 2008 ] [ PBS Helpdesk 0.93 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> html_graphs.php3 (source)

   1  <SCRIPT language="php">
   2  
   3  /*

   4  #######################################################################

   5  #

   6  #       $Id: HTML_Graphs.php3,v 1.5 1998/11/05 06:15:52 pdavis Exp pdavis $

   7  #

   8  #   $Author: pdavis $

   9  #   $Locker: pdavis $

  10  #

  11  #     $Date: 1998/11/05 06:15:52 $

  12  #

  13  #   $Source: C:\\My\040Documents\\RCS\\H\\Webguys\\pdavis\\Programs\\html_graphs\\HTML_Graphs.php3,v $

  14  # $Revision: 1.5 $

  15  #    $State: Exp $

  16  #

  17  #      $Log: HTML_Graphs.php3,v $

  18  #      Revision 1.5  1998/11/05 06:15:52  pdavis

  19  #      Added error_reporting setting per Jean-Pierre Arneodo's request.

  20  #      (Though redundant) Added html_graph_init() to initialize vars array.

  21  #

  22  #      Revision 1.4  1998/07/08 05:24:25  pdavis

  23  #      Add double_vertical_graph from Jan Diepens.

  24  #      Added "max" function to find $largest in examples page.

  25  #      Added code to increase values of zero to one.

  26  #      Added double_vertical_graph example

  27  #      Combined all source into one zip.

  28  #

  29  #      Revision 1.3  1998/06/17 23:37:19  pdavis

  30  #      Added mixed color codes and images to double graph.

  31  #

  32  #      Revision 1.2  1998/06/17 21:20:20  pdavis

  33  #      Fixed Background problem, added mixed color codes and graphics.

  34  #

  35  #      Revision 1.1  1998/06/17 15:52:41  pdavis

  36  #      Initial revision

  37  #

  38  #

  39  #######################################################################

  40  #

  41  #     *

  42  #     *  Phil Davis

  43  #     *

  44  #     *  Smyrna, Tennessee  37167  USA

  45  #     *

  46  #     *  pdavis@pobox.com

  47  #     *  http://www.pobox.com/~pdavis/

  48  #     *

  49  #

  50  #     (C) Copyright 1998 

  51  #         Phil Davis

  52  #         Printed in the United States of America

  53  #

  54  #     This program is free software; you can redistribute it

  55  #     and/or modify it under the terms of the GNU General

  56  #     Public License version 2 as published by the Free

  57  #     Software Foundation.

  58  #

  59  #     This program is distributed in the hope that it will

  60  #     be useful, but WITHOUT ANY WARRANTY; without even the

  61  #     implied warranty of MERCHANTABILITY or FITNESS FOR A

  62  #     PARTICULAR PURPOSE.  See the GNU General Public License

  63  #     for more details.

  64  #

  65  #     Released under GNU Public License v2.0, available

  66  #     at www.fsf.org.  The author hereby disclaims all

  67  #     warranties relating to this software, express or implied,

  68  #     including with no limitation any implied warranties of

  69  #     merchantability, quality performance, or fitness for a

  70  #     particular purpose. The author and their distributors

  71  #     shall not be liable for any special, incidental,

  72  #     consequential, indirect or similar damages due to loss

  73  #     of data, even if an agent of the author has been found

  74  #     to be the source of loss or damage. In no event shall the

  75  #     author's liability for any damages ever exceed the price

  76  #     paid for the license to use software, regardless of the

  77  #     form of the claim. The person using the software bears all

  78  #     risk as to the quality and performance of the software.

  79  #

  80  #     Swim at your own risk!

  81  #

  82  #     This software program, documentation, accompanying

  83  #     written and disk-based notes and specifications, and all

  84  #     referenced and related program files, screen display

  85  #     renditions, and text files, are the property of the

  86  #     author.

  87  #

  88  #     The authors have done their best to insure that the

  89  #     material found in this document is both useful and

  90  #     accurate. However, please be aware that errors may exist,

  91  #     the author does not make any guarantee concerning the

  92  #     accuracy of the information found here or in the uses

  93  #     to which it may be put.

  94  #

  95  #######################################################################

  96  #

  97  #  About:

  98  #

  99  #  The following PHP3 code provides a nice class interface for

 100  #  html graphs.  It provides a single, reasonably consistent

 101  #  interface for creating HTML based graphs.  The idea behind

 102  #  this code is that the user of the class sets up four or five

 103  #  arrays and pass these to html_graph() which then takes

 104  #  care of all the messy HTML layout.  I am reasonably happy

 105  #  with the outcome of this interface.  The HTML that must be

 106  #  generated for HTML graphs *is* messy, and the interface is

 107  #  very clean and flexible.  I think that once you generate

 108  #  one graph with it, you'll never look at creating HTML graphs

 109  #  the same.  The arrays that must be set up consist of:

 110  #

 111  #       * A names array containing column/row identifiers ($names)

 112  #       * One or two values arrays containg corresponding 

 113  #         values to the column/row names ($values & $dvalues)

 114  #       * One or two bars array which also corresponds to the names

 115  #         array.  The values in these arrays are URLS to graphics

 116  #         or color codes starting with a # which will be used to

 117  #         generate the graph bar.  Color codes and graphics may

 118  #         be mixed in the same chart, although color codes can't 

 119  #         be used on Vertical charts. ($bars & $dbars)

 120  #       * The heart of customization... a vals array.  If this 

 121  #         array isn't created then html_graphs will use all 

 122  #         default values for the chart.  Items that are customizable

 123  #         include font styles & colors, backgrounds, graphics, 

 124  #         labels, cellspacing, cellpadding, borders, anotations

 125  #         and scaling factor. ($vals)

 126  #

 127  #######################################################################

 128  #

 129  #  Known Bugs:

 130  # 

 131  #  * Currently the $vals["background"] tag element doesn't 

 132  #    work in Netscape.

 133  #

 134  #######################################################################

 135  # 

 136  #  To Do: 

 137  # 

 138  #  * Would like to make the $vals array to html_graph() completely

 139  #    optional.  Currently it has to at least be an empty array.

 140  #

 141  #######################################################################

 142  #

 143  # Contributors:

 144  #

 145  #  Jan Diepens - Eindhoven University of Technologie

 146  #  Jean-Pierre Arneodo

 147  #

 148  #######################################################################

 149  #

 150  # Contact:

 151  #

 152  # If you have questions, suggestions, bugs, bug fixes, or enhancements 

 153  # please send them to pdavis@pobox.com so that they may be wrapped into 

 154  # future versions of HTML_Graph.

 155  #

 156  #######################################################################

 157  #

 158  #  Examples:

 159  #

 160  #  See http://www.pobox.com/~pdavis/programs/

 161  #

 162  #######################################################################

 163  */
 164  
 165  /*

 166  #######################################################################

 167  #

 168  #  Function:  html_graph($names, $values, $bars, $vals[, $dvalues, $dbars]) 

 169  #

 170  #   Purpose:  Calls routines to initialize defaults, set up table

 171  #             print data, and close table.

 172  #

 173  # Arguments: 

 174  #                   $names - Array of element names.

 175  #                  $values - Array of corresponding values for elements.

 176  #                    $bars - Array of corresponding graphic image names 

 177  #                            or color codes (begining with a #) for elements.

 178  #                            Color codes can't be used on vertical charts.

 179  #                 $dvalues - Array of corresponding values for elements.

 180  #                            This set is required only in the double graph.

 181  #                   $dbars - Array of corresponding graphic image names 

 182  #                            or color codes (begining with a #) for elements.

 183  #                            This set is required only in the double graph.

 184  #

 185  #                    $vals -  array("vlabel"=>"",

 186  #                                   "hlabel"=>"",

 187  #                                   "type"=>"",

 188  #                                   "cellpadding"=>"",

 189  #                                   "cellspacing"=>"",

 190  #                                   "border"=>"",

 191  #                                   "width"=>"",

 192  #                                   "background"=>"",

 193  #                                   "vfcolor"=>"",

 194  #                                   "hfcolor"=>"",

 195  #                                   "vbgcolor"=>"",

 196  #                                   "hbgcolor"=>"",

 197  #                                   "vfstyle"=>"",

 198  #                                   "hfstyle"=>"",

 199  #                                   "noshowvals"=>"",

 200  #                                   "scale"=>"",

 201  #                                   "namebgcolor"=>"",

 202  #                                   "valuebgcolor"=>"",

 203  #                                   "namefcolor"=>"",

 204  #                                   "valuefcolor"=>"",

 205  #                                   "namefstyle"=>"",

 206  #                                   "valuefstyle"=>"",

 207  #                                   "doublefcolor"=>"")

 208  #

 209  #             Where:

 210  #

 211  #                   vlabel - Vertical Label to apply

 212  #                            default is NUL

 213  #                   hlabel - Horizontal Label to apply

 214  #                            default is NUL

 215  #                     type - Type of graph 

 216  #                            0 = horizontal

 217  #                            1 = vertical

 218  #                            2 = double horizontal

 219  #                            3 = double vertical 

 220  #                            default is 0

 221  #              cellpadding - Padding for the overall table

 222  #                            default is 0

 223  #              cellspacing - Space for the overall table

 224  #                            default is 0

 225  #                   border - Border size for the overall table

 226  #                            default is 0

 227  #                    width - Width of the overall table

 228  #                            default is NUL

 229  #               background - Background image for the overall table

 230  #                            If this value exists then no BGCOLOR

 231  #                            codes will be added to table elements.

 232  #                            default is NUL

 233  #                  vfcolor - Vertical label font color

 234  #                            default is #000000

 235  #                  hfcolor - Horizontal label font color

 236  #                            default is #000000

 237  #                 vbgcolor - Vertical label background color

 238  #                            Not used if background is set

 239  #                            default is #FFFFFF

 240  #                 hbgcolor - Horizontal label background color

 241  #                            Not used if background is set

 242  #                            default is #FFFFFF

 243  #                  vfstyle - Vertical label font style

 244  #                            default is NUL 

 245  #                  hfstyle - Horizontal label font style

 246  #                            default is NUL 

 247  #               noshowvals - Don't show numeric value at end of graphic

 248  #                            Boolean value, default is FALSE

 249  #                    scale - Scale values by some number.

 250  #                            default is 1.

 251  #              namebgcolor - Color code for element name cells

 252  #                            Not used if background is set

 253  #                            default is "#000000"

 254  #             valuebgcolor - Color code for value cells

 255  #                            Not used if background is set

 256  #                            default is "#000000"

 257  #               namefcolor - Color code for font of name element

 258  #                            default is "#FFFFFF"

 259  #              valuefcolor - Color code for font of value element

 260  #                            default is "#000000"

 261  #               namefstyle - Style code for font of name element

 262  #                            default is NUL 

 263  #              valuefstyle - Style code for font of value element

 264  #                            default is NUL 

 265  #             doublefcolor - Color code for font of second element value

 266  #                            default is "#886666"

 267  #

 268  #######################################################################

 269  */
 270  function html_graph($names, $values, $bars, $vals, $dvalues=0, $dbars=0) 
 271     {
 272      // Set the error level on entry and exit so as not to interfear

 273      // with anyone elses error checking.

 274      $er = error_reporting(1);
 275  
 276      // Set the values that the user didn't

 277      $vals = hv_graph_defaults($vals);
 278      start_graph($vals, $names);
 279  
 280      if ($vals["type"] == 0)
 281         {
 282          horizontal_graph($names, $values, $bars, $vals);
 283         }
 284      elseif ($vals["type"] == 1)
 285         {
 286          vertical_graph($names, $values, $bars, $vals);
 287         }
 288      elseif ($vals["type"] == 2)
 289         {
 290          double_horizontal_graph($names, $values, $bars, $vals, $dvalues, $dbars);
 291         }
 292      elseif ($vals["type"] == 3)
 293         {
 294          double_vertical_graph($names, $values, $bars, $vals, $dvalues, $dbars);
 295         }
 296  
 297      end_graph();
 298  
 299      // Set the error level back to where it was.

 300      error_reporting($er);  
 301     }
 302  
 303  /*

 304  ####################################################################### 

 305  #

 306  #  Function:  html_graph_init()

 307  #

 308  #   Purpose:  Sets up the $vals array by initializing all values to 

 309  #             null.  Used to avoid warnings from error_reporting being

 310  #             set high.  This routine only needs to be called if you 

 311  #             are woried about using uninitialized variables.

 312  #           

 313  #   Returns:  The initialized $vals array

 314  # 

 315  ####################################################################### 

 316  */
 317  function html_graph_init()
 318     {
 319      $vals = array("vlabel"=>"",
 320                    "hlabel"=>"",
 321                    "type"=>"",
 322                    "cellpadding"=>"",
 323                    "cellspacing"=>"",
 324                    "border"=>"",
 325                    "width"=>"",
 326                    "background"=>"",
 327                    "vfcolor"=>"",
 328                    "hfcolor"=>"",
 329                    "vbgcolor"=>"",
 330                    "hbgcolor"=>"",
 331                    "vfstyle"=>"",
 332                    "hfstyle"=>"",
 333                    "noshowvals"=>"",
 334                    "scale"=>"",
 335                    "namebgcolor"=>"",
 336                    "valuebgcolor"=>"",
 337                    "namefcolor"=>"",
 338                    "valuefcolor"=>"",
 339                    "namefstyle"=>"",
 340                    "valuefstyle"=>"",
 341                    "doublefcolor"=>"");
 342  
 343      return($vals);
 344     }
 345  /*

 346  ####################################################################### 

 347  #

 348  #  Function:  start_graph($vals, $names)

 349  #

 350  #   Purpose:  Prints out the table header and graph labels.

 351  #

 352  ####################################################################### 

 353  */
 354  function start_graph($vals, $names)
 355     {
 356      print '<TABLE';
 357      print ' CELLPADDING="' . $vals["cellpadding"] . '"';
 358      print ' CELLSPACING="' . $vals["cellspacing"] . '"';
 359      print ' BORDER="' . $vals["border"] . '"';
 360  
 361      if ($vals["width"] != 0) { print ' WIDTH="' . $vals["width"] . '"'; }
 362      if ($vals["background"]) { print ' BACKGROUND="' . $vals["background"] . '"'; }
 363  
 364      print '>';
 365  
 366      if (($vals["vlabel"]) || ($vals["hlabel"]))
 367         {
 368          if (($vals["type"] == 0) || ($vals["type"] == 2 ))// horizontal chart
 369             { 
 370              $rowspan = SizeOf($names) + 1; 
 371              $colspan = 3; 
 372             }
 373          elseif ($vals["type"] == 1 || ($vals["type"] == 3 )) // vertical chart
 374             {
 375              $rowspan = 3;
 376              $colspan = SizeOf($names) + 1; 
 377             }
 378  
 379          print '<TR><TD ALIGN=CENTER VALIGN="CENTER" ';
 380  
 381          // If a background was choosen don't print cell BGCOLOR

 382          if (! $vals["background"]) { print 'BGCOLOR="' . $vals["hbgcolor"] . '"'; }
 383  
 384          print ' COLSPAN="' . $colspan . '">';
 385          print '<FONT COLOR="' . $vals["hfcolor"] . '" STYLE="' . $vals["hfstyle"] . '">';
 386          print "<B>" . $vals["hlabel"] . "</B>";
 387          print '</FONT></TD></TR>';
 388  
 389          print '<TR><TD ALIGN="CENTER" VALIGN="CENTER" ';
 390  
 391          // If a background was choosen don't print cell BGCOLOR

 392          if (! $vals["background"]) { print 'BGCOLOR="' . $vals["vbgcolor"] . '"'; }
 393  
 394          print ' ROWSPAN="' . $rowspan . '">';
 395          print '<FONT COLOR="' . $vals["vfcolor"] . '" STYLE="' . $vals["vfstyle"] . '">';
 396          print "<B>" . $vals["vlabel"] . "</B>";
 397          print '</FONT></TD>';
 398         }
 399     }
 400  
 401  /*

 402  ####################################################################### 

 403  #

 404  #  Function:  end_graph()

 405  #

 406  #   Purpose:  Prints out the table footer.

 407  #

 408  ####################################################################### 

 409  */
 410  function end_graph()
 411     {
 412      print "</TABLE>";
 413     }
 414  
 415  /*

 416  ####################################################################### 

 417  #

 418  #  Function:  hv_graph_defaults($vals)

 419  #

 420  #   Purpose:  Sets the default values for the $vals array 

 421  #

 422  ####################################################################### 

 423  */
 424  function hv_graph_defaults($vals)
 425     {
 426      if (! $vals["vfcolor"]) { $vals["vfcolor"]="#000000"; }
 427      if (! $vals["hfcolor"]) { $vals["hfcolor"]="#000000"; }
 428      if (! $vals["vbgcolor"]) { $vals["vbgcolor"]="#FFFFFF"; }
 429      if (! $vals["hbgcolor"]) { $vals["hbgcolor"]="#FFFFFF"; }
 430      if (! $vals["cellpadding"]) { $vals["cellpadding"]=0; }
 431      if (! $vals["cellspacing"]) { $vals["cellspacing"]=0; }
 432      if (! $vals["border"]) { $vals["border"]=0; }
 433      if (! $vals["scale"]) { $vals["scale"]=1; }
 434      if (! $vals["namebgcolor"]) { $vals["namebgcolor"]="#FFFFFF"; }
 435      if (! $vals["valuebgcolor"]) { $vals["valuebgcolor"]="#FFFFFF"; }
 436      if (! $vals["namefcolor"]) { $vals["namefcolor"]="#000000"; }
 437      if (! $vals["valuefcolor"]) { $vals["valuefcolor"]="#000000"; }
 438      if (! $vals["doublefcolor"]) { $vals["doublefcolor"]="#886666"; }
 439  
 440      return ($vals);
 441     }
 442  
 443  /*

 444  ####################################################################### 

 445  #

 446  #  Function:  horizontal_graph($names, $values, $bars, $vals) 

 447  #

 448  #   Purpose:  Prints out the actual data for the horizontal chart. 

 449  #

 450  ####################################################################### 

 451  */
 452  function horizontal_graph($names, $values, $bars, $vals) 
 453     {
 454      for( $i=0;$i<SizeOf($values);$i++ )
 455         { 
 456  ?>
 457         <TR>
 458          <TD ALIGN=RIGHT 
 459  <?
 460          // If a background was choosen don't print cell BGCOLOR

 461          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["namebgcolor"] . '"'; }
 462  ?>
 463           >
 464           <FONT SIZE="-1" COLOR="<? echo $vals["namefcolor"] ?>" STYLE="<? echo $vals["namefstyle"] ?>">
 465           <? echo $names[$i] ?>
 466           </FONT>
 467          </TD>
 468          <TD  ALIGN=LEFT 
 469  <?
 470          // If a background was choosen don't print cell BGCOLOR

 471          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["valuebgcolor"] . '"'; }
 472  ?>
 473           >
 474  <?
 475          // Decide if the value in bar is a color code or image.

 476          if (ereg("^#", $bars[$i]))
 477             { 
 478  ?>
 479              <TABLE ALIGN="LEFT" CELLPADDING=0 CELLSPACING=0 
 480               BGCOLOR="<? echo $bars[$i] ?>" 
 481               WIDTH="<? echo $values[$i] * $vals["scale"] ?>">
 482               <TR><TD>&nbsp</TD></TR>
 483              </TABLE>
 484  <?
 485              }
 486           else
 487              {
 488               print '<IMG SRC="' . $bars[$i] . '"';
 489               print ' HEIGHT=10 WIDTH="' . $values[$i] * $vals["scale"] . '">';
 490              }
 491          if (! $vals["noshowvals"])
 492             {
 493              print '<I><FONT SIZE="-2" COLOR="' . $vals["valuefcolor"] . '" ';
 494              print ' STYLE="' . $vals["valuefstyle"] . '">('; 
 495              print $values[$i] . ")</FONT></I>";
 496             }
 497  ?>
 498          </TD> 
 499         </TR>
 500  <?
 501         } // endfor

 502  
 503     } // end horizontal_graph

 504  
 505  /*

 506  ####################################################################### 

 507  #

 508  #  Function:  vertical_graph($names, $values, $bars, $vals) 

 509  #

 510  #   Purpose:  Prints out the actual data for the vertical chart. 

 511  #

 512  ####################################################################### 

 513  */
 514  function vertical_graph($names, $values, $bars, $vals) 
 515     {
 516      print "<TR>";
 517  
 518      for( $i=0;$i<SizeOf($values);$i++ )
 519         { 
 520  
 521          print '<TD  ALIGN="CENTER" VALIGN="BOTTOM" ';
 522  
 523          // If a background was choosen don't print cell BGCOLOR

 524          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["valuebgcolor"] . '"'; }
 525          print ">";
 526  
 527          if (! $vals["noshowvals"])
 528             {
 529              print '<I><FONT SIZE="-2" COLOR="' . $vals["valuefcolor"] . '" ';
 530              print ' STYLE="' . $vals["valuefstyle"] . '">('; 
 531              print $values[$i] . ")</FONT></I><BR>";
 532             }
 533  ?>
 534  
 535           <IMG SRC="<? echo $bars[$i] ?>" WIDTH=5 HEIGHT="<? 
 536  
 537          // Values of zero are displayed wrong because a image height of zero 

 538          // gives a strange behavior in Netscape. For this reason the height 

 539          // is set at 1 pixel if the value is zero. - Jan Diepens

 540          if ($values[$i] != 0)
 541             {
 542              echo $values[$i] * $vals["scale"];
 543             } 
 544          else 
 545             { 
 546              echo "1";
 547             } 
 548  ?>">
 549  
 550           </TD> 
 551  <?
 552         } // endfor

 553  
 554      print "</TR><TR>";
 555  
 556      for( $i=0;$i<SizeOf($values);$i++ )
 557         { 
 558  ?>
 559          <TD ALIGN="CENTER" VALIGN="TOP" 
 560  
 561  <?
 562          // If a background was choosen don't print cell BGCOLOR

 563          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["namebgcolor"] . '"'; }
 564  ?>
 565           >
 566           <FONT SIZE="-1" COLOR="<? echo $vals["namefcolor"] ?>" STYLE="<? echo $vals["namefstyle"] ?>">
 567           <? echo $names[$i] ?>
 568           </FONT>
 569          </TD>
 570  <?
 571         } // endfor

 572  
 573     } // end vertical_graph 

 574  
 575  /*

 576  ####################################################################### 

 577  #

 578  #  Function:  double_horizontal_graph($names, $values, $bars, 

 579  #                                     $vals, $dvalues, $dbars) 

 580  #

 581  #   Purpose:  Prints out the actual data for the double horizontal chart. 

 582  #

 583  ####################################################################### 

 584  */
 585  function double_horizontal_graph($names, $values, $bars, $vals, $dvalues, $dbars) 
 586     {
 587      for( $i=0;$i<SizeOf($values);$i++ )
 588         { 
 589  ?>
 590         <TR>
 591          <TD ALIGN=RIGHT 
 592  <?
 593          // If a background was choosen don't print cell BGCOLOR

 594          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["namebgcolor"] . '"'; }
 595  ?>
 596           >
 597           <FONT SIZE="-1" COLOR="<? echo $vals["namefcolor"] ?>" STYLE="<? echo $vals["namefstyle"] ?>">
 598           <? echo $names[$i] ?>
 599           </FONT>
 600          </TD>
 601          <TD  ALIGN=LEFT 
 602  <?
 603          // If a background was choosen don't print cell BGCOLOR

 604          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["valuebgcolor"] . '"'; }
 605  ?>
 606           >
 607           <TABLE ALIGN="LEFT" CELLPADDING=0 CELLSPACING=0 WIDTH="<? echo $dvalues[$i] * $vals["scale"] ?>">
 608            <TR><TD 
 609  <?
 610          // Set background to a color if it starts with # or

 611          // an image otherwise.

 612          if (ereg("^#", $dbars[$i])) { print 'BGCOLOR="' . $dbars[$i] . '">'; }
 613          else { print 'BACKGROUND="' . $dbars[$i] . '">'; }
 614  ?>
 615             <NOWRAP>
 616  <?
 617          // Decide if the value in bar is a color code or image.

 618          if (ereg("^#", $bars[$i]))
 619             { 
 620  ?>
 621              <TABLE ALIGN="LEFT" CELLPADDING=0 CELLSPACING=0 
 622               BGCOLOR="<? echo $bars[$i] ?>" 
 623               WIDTH="<? echo $values[$i] * $vals["scale"] ?>">
 624               <TR><TD>&nbsp</TD></TR>
 625              </TABLE>
 626  <?
 627              }
 628           else
 629              {
 630               print '<IMG SRC="' . $bars[$i] . '"';
 631               print ' HEIGHT=10 WIDTH="' . $values[$i] * $vals["scale"] . '">';
 632              }          
 633  
 634          if (! $vals["noshowvals"])
 635             {
 636              print '<I><FONT SIZE="-3" COLOR="' . $vals["valuefcolor"] . '" ';
 637              print ' STYLE="' . $vals["valuefstyle"] . '">('; 
 638              print $values[$i] . ")</FONT></I>";
 639             }
 640  ?>
 641             </NOWRAP>
 642            </TD></TR>
 643           </TABLE>
 644  <?
 645          if (! $vals["noshowvals"])
 646             {
 647              print '<I><FONT SIZE="-3" COLOR="' . $vals["doublefcolor"] . '" ';
 648              print ' STYLE="' . $vals["valuefstyle"] . '">('; 
 649              print $dvalues[$i] . ")</FONT></I>";
 650             }
 651  ?>
 652          </TD> 
 653         </TR>
 654  <?
 655         } // endfor

 656  
 657     } // end double_horizontal_graph

 658  
 659  /*

 660  ####################################################################### 

 661  #

 662  #  Function:  double_vertical_graph($names, $values, $bars, $vals, $dvalues, $dbars) 

 663  #

 664  #   Purpose:  Prints out the actual data for the double vertical chart. 

 665  #

 666  #    Author: Jan Diepens

 667  #

 668  ####################################################################### 

 669  */
 670  function double_vertical_graph($names, $values, $bars, $vals, $dvalues, $dbars) 
 671     {
 672     // print "<TR>";

 673  
 674      for( $i=0;$i<SizeOf($values);$i++ )
 675         { 
 676  
 677          print '<TD  ALIGN="CENTER" VALIGN="BOTTOM" ';
 678          // If a background was choosen don't print cell BGCOLOR

 679          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["valuebgcolor"] . '"'; }
 680          print ">";
 681  
 682      print '<TABLE><TR><TD ALIGN="CENTER" VALIGN="BOTTOM" ';
 683  
 684          // If a background was choosen don't print cell BGCOLOR

 685          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["valuebgcolor"] . '"'; }
 686          print ">";
 687  
 688          if (! $vals["noshowvals"])
 689             {
 690              print '<I><FONT SIZE="-2" COLOR="' . $vals["valuefcolor"] . '" ';
 691              print ' STYLE="' . $vals["valuefstyle"] . '">('; 
 692              print $values[$i] . ")</FONT></I><BR>";
 693             }
 694  ?>
 695  
 696           <IMG SRC="<? echo $bars[$i] ?>" WIDTH=10 HEIGHT="<? if ($values[$i]!=0){
 697          echo $values[$i] * $vals["scale"];
 698          } else { echo "1";} ?>">
 699           </TD><TD ALIGN="CENTER" VALIGN="BOTTOM"
 700  <?
 701           // If a background was choosen don't print cell BGCOLOR

 702          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["valuebgcolor"] . '"'; }
 703          print ">";
 704  
 705          if (! $vals["noshowvals"])
 706             {
 707              print '<I><FONT SIZE="-2" COLOR="' . $vals["doublefcolor"] . '" ';
 708              print ' STYLE="' . $vals["valuefstyle"] . '">('; 
 709              print $dvalues[$i] . ")</FONT></I><BR>";
 710             }
 711  ?>
 712  
 713           <IMG SRC="<? echo $dbars[$i] ?>" WIDTH=10 HEIGHT="<? if ($dvalues[$i]!=0){
 714          echo $dvalues[$i] * $vals["scale"];
 715          } else { echo "1";} ?>">
 716           </TD></TR></TABLE>
 717       </TD>
 718  <?
 719         } // endfor

 720  
 721      print "</TR><TR>";
 722  
 723      for( $i=0;$i<SizeOf($values);$i++ )
 724         { 
 725  ?>
 726          <TD ALIGN="CENTER" VALIGN="TOP" 
 727  
 728  <?
 729          // If a background was choosen don't print cell BGCOLOR

 730          if (! $vals["background"]) { print ' BGCOLOR="' . $vals["namebgcolor"] . '"'; }
 731  ?>
 732           >
 733           <FONT SIZE="-1" COLOR="<? echo $vals["namefcolor"] ?>" STYLE="<? echo $vals["namefstyle"] ?>">
 734           <? echo $names[$i] ?>
 735           </FONT>
 736          </TD>
 737  <?
 738         } // endfor

 739  
 740     } // end double_vertical_graph

 741      print "</TR>";
 742  
 743  </SCRIPT>


[ Powered by PHPXref - Served by Debian GNU/Linux ]