{"id":685,"date":"2002-11-26T02:43:20","date_gmt":"2002-11-26T02:43:20","guid":{"rendered":"http:\/\/dev.jblove.net\/?p=685"},"modified":"2002-11-26T02:43:20","modified_gmt":"2002-11-26T02:43:20","slug":"htmlgraph%eb%a1%9c-%ec%89%bd%ea%b3%a0-%eb%a9%8b%ec%9e%88%eb%8a%94-%ea%b7%b8%eb%9e%98%ed%94%84-%ea%b7%b8%eb%a6%ac%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/jblove.net\/?p=685","title":{"rendered":"html_graph\ub85c \uc27d\uace0 \uba4b\uc788\ub294 \uadf8\ub798\ud504 \uadf8\ub9ac\uae30"},"content":{"rendered":"<p>\n\uc77c\ub2e8\uc740 html_graphs.php3 \uc758 \ub0b4\uc6a9\uc785\ub2c8\ub2e4.<br \/>\n<?php <br \/>\n$html_graphs_included = 1; <\/p>\n<p>\/* <br \/>\n####################################################################### <br \/>\n# <br \/>\n#       $Id: html_graphs.php3,v 1.3 1998\/06\/17 23:37:19 pdavis Exp $ <br \/>\n# <br \/>\n#   $Author: pdavis $ <br \/>\n#   $Locker:  $ <br \/>\n# <br \/>\n#     $Date: 1998\/06\/17 23:37:19 $ <br \/>\n# <br \/>\n#   $Source: J:\\programs\\PHP\/RCS\/html_graphs.php3,v $ <br \/>\n# $Revision: 1.3 $ <br \/>\n#    $State: Exp $ <br \/>\n# <br \/>\n#      $Log: html_graphs.php3,v $ <br \/>\n#      Revision 1.3  1998\/06\/17 23:37:19  pdavis <br \/>\n#      Added mixed color codes and images to double graph. <br \/>\n# <br \/>\n#      Revision 1.2  1998\/06\/17 21:20:20  pdavis <br \/>\n#      Fixed Background problem, added mixed color codes and graphics. <br \/>\n# <br \/>\n#      Revision 1.1  1998\/06\/17 15:52:41  pdavis <br \/>\n#      Initial revision <br \/>\n# <br \/>\n# <br \/>\n####################################################################### <br \/>\n# <br \/>\n#     * <br \/>\n#     *  Phil Davis <br \/>\n#     * <br \/>\n#     *  Smyrna, Tennessee  37167  USA <br \/>\n#     * <br \/>\n#     *  pdavis@pobox.com <br \/>\n#     *  http:\/\/www.pobox.com\/~pdavis\/ <br \/>\n#     * <br \/>\n# <br \/>\n#     (C) Copyright 1998  <br \/>\n#         Phil Davis <br \/>\n#         Printed in the United States of America <br \/>\n# <br \/>\n#     This program is free software; you can redistribute it <br \/>\n#     and\/or modify it under the terms of the GNU General <br \/>\n#     Public License version 2 as published by the Free <br \/>\n#     Software Foundation. <br \/>\n# <br \/>\n#     This program is distributed in the hope that it will <br \/>\n#     be useful, but WITHOUT ANY WARRANTY; without even the <br \/>\n#     implied warranty of MERCHANTABILITY or FITNESS FOR A <br \/>\n#     PARTICULAR PURPOSE.  See the GNU General Public License <br \/>\n#     for more details. <br \/>\n# <br \/>\n#     Released under GNU Public License v2.0, available <br \/>\n#     at www.fsf.org.  The author hereby disclaims all <br \/>\n#     warranties relating to this software, express or implied, <br \/>\n#     including with no limitation any implied warranties of <br \/>\n#     merchantability, quality performance, or fitness for a <br \/>\n#     particular purpose. The author and their distributors <br \/>\n#     shall not be liable for any special, incidental, <br \/>\n#     consequential, indirect or similar damages due to loss <br \/>\n#     of data, even if an agent of the author has been found <br \/>\n#     to be the source of loss or damage. In no event shall the <br \/>\n#     author&#8217;s liability for any damages ever exceed the price <br \/>\n#     paid for the license to use software, regardless of the <br \/>\n#     form of the claim. The person using the software bears all <br \/>\n#     risk as to the quality and performance of the software. <br \/>\n# <br \/>\n#     Swim at your own risk! <br \/>\n# <br \/>\n#     This software program, documentation, accompanying <br \/>\n#     written and disk-based notes and specifications, and all <br \/>\n#     referenced and related program files, screen display <br \/>\n#     renditions, and text files, are the property of the <br \/>\n#     author. <br \/>\n# <br \/>\n#     The authors have done their best to insure that the <br \/>\n#     material found in this document is both useful and <br \/>\n#     accurate. However, please be aware that errors may exist, <br \/>\n#     the author does not make any guarantee concerning the <br \/>\n#     accuracy of the information found here or in the uses <br \/>\n#     to which it may be put. <br \/>\n# <br \/>\n####################################################################### <br \/>\n# <br \/>\n#  About: <br \/>\n# <br \/>\n#  The following PHP3 code provides a nice class interface for <br \/>\n#  html graphs.  It provides a single, reasonably consistent <br \/>\n#  interface for creating HTML based graphs.  The idea behind <br \/>\n#  this code is that the user of the class sets up four or five <br \/>\n#  arrays and pass these to html_graph() which then takes <br \/>\n#  care of all the messy HTML layout.  I am reasonably happy <br \/>\n#  with the outcome of this interface.  The HTML that must be <br \/>\n#  generated for HTML graphs *is* messy, and the interface is <br \/>\n#  very clean and flexible.  I think that once you generate <br \/>\n#  one graph with it, you&#8217;ll never look at creating HTML graphs <br \/>\n#  the same.  The arrays that must be set up consist of: <br \/>\n# <br \/>\n#       * A names array containing column\/row identifiers ($names) <br \/>\n#       * One or two values arrays containg corresponding  <br \/>\n#         values to the column\/row names ($values &#038; $dvalues) <br \/>\n#       * One or two bars array which also corresponds to the names <br \/>\n#         array.  The values in these arrays are URLS to graphics <br \/>\n#         or color codes starting with a # which will be used to <br \/>\n#         generate the graph bar.  Color codes and graphics may <br \/>\n#         be mixed in the same chart, although color codes can&#8217;t  <br \/>\n#         be used on Vertical charts. ($bars &#038; $dbars) <br \/>\n#       * The heart of customization&#8230; a vals array.  If this  <br \/>\n#         array isn&#8217;t created then html_graphs will use all  <br \/>\n#         default values for the chart.  Items that are customizable <br \/>\n#         include font styles &#038; colors, backgrounds, graphics,  <br \/>\n#         labels, cellspacing, cellpadding, borders, anotations <br \/>\n#         and scaling factor. ($vals) <br \/>\n# <br \/>\n####################################################################### <br \/>\n#  Known Bugs: <br \/>\n#  * Currently the $vals[background] tag element doesn&#8217;t  <br \/>\n#    work in Netscape. <br \/>\n####################################################################### <br \/>\n#  To Do:  <br \/>\n#  <br \/>\n#  * Would like to make the $vals array to html_graph() completely <br \/>\n#    optional.  Currently it has to at least be an empty array. <br \/>\n# <br \/>\n####################################################################### <br \/>\n# Contact: <br \/>\n# <br \/>\n#  If you have questions, suggestions, bugs, bug fixes, or enhancements  <br \/>\n#  please send them to pdavis@pobox.com so that they may be wrapped into  <br \/>\n#  future versions of HTML_Graph. <br \/>\n####################################################################### <br \/>\n#  Examples: <br \/>\n#  See http:\/\/www.pobox.com\/~pdavis\/programs\/ <br \/>\n####################################################################### <br \/>\n*\/ <\/p>\n<p>\/* <br \/>\n####################################################################### <br \/>\n# <br \/>\n#  Function:  html_graph($names, $values, $bars, $vals[, $dvalues, $dbars])  <br \/>\n# <br \/>\n#   Purpose:  Calls routines to initialize defaults, set up table <br \/>\n#             print data, and close table. <br \/>\n# <br \/>\n# Arguments:  <br \/>\n#                   $names &#8211; Array of element names. <br \/>\n#                  $values &#8211; Array of corresponding values for elements. <br \/>\n#                    $bars &#8211; Array of corresponding graphic image names  <br \/>\n#                            or color codes (begining with a #) for elements. <br \/>\n#                            Color codes can&#8217;t be used on vertical charts. <br \/>\n#                 $dvalues &#8211; Array of corresponding values for elements. <br \/>\n#                            This set is required only in the double graph. <br \/>\n#                   $dbars &#8211; Array of corresponding graphic image names  <br \/>\n#                            or color codes (begining with a #) for elements. <br \/>\n#                            This set is required only in the double graph. <br \/>\n# <br \/>\n#                    $vals &#8211;  array(&#8220;vlabel&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;hlabel&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;type&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;cellpadding&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;cellspacing&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;border&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;width&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;background&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;vfcolor&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;hfcolor&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;vbgcolor&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;hbgcolor&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;vfstyle&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;hfstyle&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;noshowvals&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;scale&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;namebgcolor&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;valuebgcolor&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;namefcolor&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;valuefcolor&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;namefstyle&#8221;=>&#8221;&#8221;, <br \/>\n#                                   &#8220;valuefstyle&#8221;=>&#8221;&#8221; <br \/>\n#                                   &#8220;doublefcolor&#8221;=>&#8221;&#8221;) <br \/>\n# <br \/>\n#             Where: <br \/>\n# <br \/>\n#                   vlabel &#8211; Vertical Label to apply <br \/>\n#                            default is NUL <br \/>\n#                   hlabel &#8211; Horizontal Label to apply <br \/>\n#                            default is NUL <br \/>\n#                     type &#8211; Type of graph  <br \/>\n#                            0 = horizontal <br \/>\n#                            1 = vertical <br \/>\n#                            2 = double horizontal  <br \/>\n#                            default is 0 <br \/>\n#              cellpadding &#8211; Padding for the overall table <br \/>\n#                            default is 0 <br \/>\n#              cellspacing &#8211; Space for the overall table <br \/>\n#                            default is 0 <br \/>\n#                   border &#8211; Border size for the overall table <br \/>\n#                            default is 0 <br \/>\n#                    width &#8211; Width of the overall table <br \/>\n#                            default is NUL <br \/>\n#               background &#8211; Background image for the overall table <br \/>\n#                            If this value exists then no BGCOLOR <br \/>\n#                            codes will be added to table elements. <br \/>\n#                            default is NUL <br \/>\n#                  vfcolor &#8211; Vertical label font color <br \/>\n#                            default is #000000 <br \/>\n#                  hfcolor &#8211; Horizontal label font color <br \/>\n#                            default is #000000 <br \/>\n#                 vbgcolor &#8211; Vertical label background color <br \/>\n#                            Not used if background is set <br \/>\n#                            default is #FFFFFF <br \/>\n#                 hbgcolor &#8211; Horizontal label background color <br \/>\n#                            Not used if background is set <br \/>\n#                            default is #FFFFFF <br \/>\n#                  vfstyle &#8211; Vertical label font style <br \/>\n#                            default is NUL  <br \/>\n#                  hfstyle &#8211; Horizontal label font style <br \/>\n#                            default is NUL  <br \/>\n#               noshowvals &#8211; Don&#8217;t show numeric value at end of graphic <br \/>\n#                            Boolean value, default is FALSE <br \/>\n#                    scale &#8211; Scale values by some number. <br \/>\n#                            default is 1. <br \/>\n#              namebgcolor &#8211; Color code for element name cells <br \/>\n#                            Not used if background is set <br \/>\n#                            default is &#8220;#000000&#8221; <br \/>\n#             valuebgcolor &#8211; Color code for value cells <br \/>\n#                            Not used if background is set <br \/>\n#                            default is &#8220;#000000&#8221; <br \/>\n#               namefcolor &#8211; Color code for font of name element <br \/>\n#                            default is &#8220;#FFFFFF&#8221; <br \/>\n#              valuefcolor &#8211; Color code for font of value element <br \/>\n#                            default is &#8220;#000000&#8221; <br \/>\n#               namefstyle &#8211; Style code for font of name element <br \/>\n#                            default is NUL  <br \/>\n#              valuefstyle &#8211; Style code for font of value element <br \/>\n#                            default is NUL  <br \/>\n#             doublefcolor &#8211; Color code for font of second element value <br \/>\n#                            default is &#8220;#886666&#8221; <br \/>\n# <br \/>\n####################################################################### <br \/>\n*\/ <br \/>\nfunction html_graph($names, $values, $bars, $vals, $dvalues=0, $dbars=0)  <br \/>\n{ <br \/>\n  \/\/ Set the values that the user didn&#8217;t <br \/>\n  $vals = hv_graph_defaults($vals); <br \/>\n  start_graph($vals, $names); <\/p>\n<p>  if ($vals[type] == 0) { <br \/>\n    horizontal_graph($names, $values, $bars, $vals); <br \/>\n  } elseif ($vals[type] == 1) { <br \/>\n    vertical_graph($names, $values, $bars, $vals); <br \/>\n  } elseif ($vals[type] == 2) { <br \/>\n    double_horizontal_graph($names, $values, $bars, $vals, $dvalues, $dbars); <br \/>\n  } <br \/>\n  end_graph(); <br \/>\n} <\/p>\n<p>#######################################################################  <br \/>\n#  Function:  start_graph($vals, $names) <br \/>\n#   Purpose:  Prints out the table header and graph labels. <br \/>\n#######################################################################  <br \/>\nfunction start_graph($vals, $names) <br \/>\n{ <br \/>\n  echo &#8220;<body vlink='white'>&#8220;;<br \/>\n  print &#8220;<center><\/p>\n<table \"; <br \/>\n  print &#8221; cellpadding=$vals[cellpadding]&#8221;; <br \/>\n  print &#8221; cellspacing=$vals[cellspacing]&#8221;; <br \/>\n  print &#8221; border=$vals[border]&#8221;; <\/p>\n<p>  if ($vals[width] != 0) { print &#8221; width=$vals[width]&#8221;; } <br \/>\n  if ($vals[background]) { print &#8221; background=$vals[background]&#8221;; } <br \/>\n  print &#8220;><br \/>\n&#8220;; <\/p>\n<p>  if (($vals[vlabel]) || ($vals[hlabel])) { <br \/>\n    if (($vals[type] == 0) || ($vals[type] == 2 )) { \/\/ horizontal chart <br \/>\n      $rowspan = sizeof($names) + 1;  <br \/>\n      $colspan = 3;  <br \/>\n    } elseif ($vals[type] == 1) { \/\/ vertical chart <br \/>\n      $rowspan = 3; <br \/>\n      $colspan = sizeof($names) + 1;  <br \/>\n    } <\/p>\n<p>    print &#8220;<\/p>\n<tr>\n<td align=center valign=center \"; <br \/>\n    \/\/ If a background was choosen don&#8217;t print cell BGCOLOR <br \/>\n    if (!$vals[background]) { print &#8220;bgcolor=$vals[hbgcolor]&#8221;; } <br \/>\n    print &#8221; colspan=$colspan>&#8221;; <br \/>\n    print &#8220;<font color=$vals[hfcolor] style=\"$vals[hfstyle]\">&#8220;; <br \/>\n    print &#8220;<b>$vals[hlabel]<\/b>&#8220;; <br \/>\n    print &#8220;<\/font><\/td>\n<\/tr>\n<p>\n&#8220;; <\/p>\n<p>    print &#8220;<\/p>\n<tr>\n<td align=center valign=center \"; <br \/>\n    \/\/ If a background was choosen don&#8217;t print cell BGCOLOR <br \/>\n    if (!$vals[background]) { print &#8220;bgcolor=$vals[vbgcolor]&#8221;; } <br \/>\n    print &#8221; ROWSPAN=$rowspan>&#8221;; <br \/>\n    print &#8220;<FONT COLOR=$vals[vfcolor] STYLE=\"$vals[vfstyle]\">&#8220;; <br \/>\n    print &#8220;<b>$vals[vlabel]<\/b>&#8220;; <br \/>\n    print &#8220;<\/font><\/td>\n<p>\n&#8220;; <br \/>\n  } <br \/>\n} <\/p>\n<p>#######################################################################  <br \/>\n#  Function:  end_graph() <br \/>\n#   Purpose:  Prints out the table footer. <br \/>\n#######################################################################  <br \/>\nfunction end_graph() <br \/>\n{ <br \/>\n  print &#8220;<\/table>\n<p>&#8220;; <br \/>\n} <\/p>\n<p>#######################################################################  <br \/>\n#  Function:  hv_graph_defaults($vals) <br \/>\n#   Purpose:  Sets the default values for the $vals array  <br \/>\n#######################################################################  <br \/>\nfunction hv_graph_defaults($vals) <br \/>\n{ <br \/>\n  if (!$vals[vfcolor]) { $vals[vfcolor]=&#8221;#000000&#8243;; } <br \/>\n  if (!$vals[hfcolor]) { $vals[hfcolor]=&#8221;#000000&#8243;; } <br \/>\n  if (!$vals[vbgcolor]) { $vals[vbgcolor]=&#8221;#FFFFFF&#8221;; } <br \/>\n  if (!$vals[hbgcolor]) { $vals[hbgcolor]=&#8221;#FFFFFF&#8221;; } <br \/>\n  if (!$vals[cellpadding]) { $vals[cellpadding]=0; } <br \/>\n  if (!$vals[cellspacing]) { $vals[cellspacing]=0; } <br \/>\n  if (!$vals[border]) { $vals[border]=0; } <br \/>\n  if (!$vals[scale]) { $vals[scale]=1; } <br \/>\n  if (!$vals[namebgcolor]) { $vals[namebgcolor]=&#8221;#FFFFFF&#8221;; } <br \/>\n  if (!$vals[valuebgcolor]) { $vals[valuebgcolor]=&#8221;#FFFFFF&#8221;; } <br \/>\n  if (!$vals[namefcolor]) { $vals[namefcolor]=&#8221;#000000&#8243;; } <br \/>\n  if (!$vals[valuefcolor]) { $vals[valuefcolor]=&#8221;#000000&#8243;; } <br \/>\n  if (!$vals[doublefcolor]) { $vals[doublefcolor]=&#8221;#886666&#8243;; } <br \/>\n  return ($vals); <br \/>\n} <\/p>\n<p>#######################################################################  <br \/>\n#  Function:  horizontal_graph($names, $values, $bars, $vals)  <br \/>\n#   Purpose:  Prints out the actual data for the horizontal chart.  <br \/>\n#######################################################################  <br \/>\nfunction horizontal_graph($names, $values, $bars, $vals)  <br \/>\n{ <br \/>\n  for ($i = 0; $i < sizeof($values); $i++) {  <br \/>\n    echo(&#8220;<TR><TD ALIGN=RIGHT\"); <br \/>\n    \/\/ If a background was choosen don&#8217;t print cell BGCOLOR <br \/>\n    if (! $vals[background]) { print &#8216; BGCOLOR=&#8221;&#8216; . $vals[namebgcolor] . &#8216;&#8221;&#8216;; } <br \/>\n    echo(&#8220;> <br \/>\n<FONT SIZE=-1 COLOR=\"$vals[namefcolor]\" STYLE=\"$vals[namefstyle]\"> <br \/>\n$names[$i] <br \/>\n<\/FONT><\/TD> <br \/>\n<TD  ALIGN=LEFT \"); <br \/>\n    \/\/ If a background was choosen don&#8217;t print cell BGCOLOR <br \/>\n    if (! $vals[background]) { print &#8216; BGCOLOR=&#8221;&#8216; . $vals[valuebgcolor] . &#8216;&#8221;&#8216;; } <br \/>\n    echo(&#8220;>&#8221;); <br \/>\n    \/\/ Decide if the value in bar is a color code or image. <br \/>\n    if (ereg(&#8220;^#&#8221;, $bars[$i])) {  <br \/>\n      $width = $values[$i] * $vals[scale]; <br \/>\n      echo(&#8220;<TABLE ALIGN=LEFT CELLPADDING=0 CELLSPACING=0  <br \/>\nBGCOLOR=$bars[$i] WIDTH=$width ><br \/>\n<TR><TD>&#038;nbsp<\/TD><\/TR> <br \/>\n<\/TABLE><br \/>\n&#8220;); <br \/>\n    } else { <br \/>\n      print &#8216;<IMG SRC=\"' . $bars[$i] . '\"'; <br \/>\n      print &#8216; HEIGHT=10 WIDTH=&#8221;&#8216; . $values[$i] * $vals[scale] . &#8216;&#8221;>&#8217;; <br \/>\n    } <br \/>\n    if (! $vals[noshowvals]) { <br \/>\n      print &#8216;<I><FONT SIZE=\"-2\" COLOR=\"' . $vals[valuefcolor] . '\" '; <br \/>\n      print &#8216; STYLE=&#8221;&#8216; . $vals[valuefstyle] . &#8216;&#8221;>(&#8216;;  <br \/>\n      print $values[$i] . &#8220;)<\/FONT><\/I>&#8220;; <br \/>\n    } <br \/>\n    echo(&#8220;<\/TD><\/TR><br \/>\n&#8220;); <br \/>\n  } <br \/>\n} <\/p>\n<p>#######################################################################  <br \/>\n#  Function:  vertical_graph($names, $values, $bars, $vals)  <br \/>\n#   Purpose:  Prints out the actual data for the vertical chart.  <br \/>\n#######################################################################  <br \/>\nfunction vertical_graph($names, $values, $bars, $vals)  <br \/>\n{ <br \/>\n  print &#8220;<\/p>\n<tr>&#8220;; <\/p>\n<p>  for ($i = 0; $i < sizeof($values); $i++) {  <br \/>\n    print &#8220;<\/p>\n<td  align=center valign=bottom \"; <br \/>\n    \/\/ If a background was choosen don&#8217;t print cell BGCOLOR <br \/>\n    if (!$vals[background]) { print &#8221; BGCOLOR=$vals[valuebgcolor]&#8221;; } <br \/>\n    print &#8220;>&#8221;; <\/p>\n<p>    if (!$vals[noshowvals]) { <br \/>\n      print &#8220;<I><font size=-2 color=$vals[valuefcolor]\"; <br \/>\n      print &#8221; style=&#8221;$vals[valuefstyle]&#8221;>($values[$i])<\/font><\/i><br \/>&#8220;; <br \/>\n    } <br \/>\n    $height = $values[$i] * $vals[scale]; <br \/>\n    echo(&#8220;<a href='.\/login.php3'><img src=$bars[$i] width=10 height=$height><\/TD><br \/>\n&#8220;); \/\/gif\uadf8\ub798\ud504\uc5d0\uc11c \uc774\ub3d9\ud558\uae30<br \/>\n  } <br \/>\n  print &#8220;<\/tr>\n<tr>&#8220;; <\/p>\n<p>  for ($i = 0; $i < sizeof($values); $i++) {  <br \/>\n    echo(&#8220;<\/p>\n<td align=center valign=top\"); <br \/>\n    \/\/ If a background was choosen don&#8217;t print cell BGCOLOR <br \/>\n    if (!$vals[background]) { print &#8221; BGCOLOR=$vals[namebgcolor]&#8221;; } <br \/>\n    echo(&#8220;><font size=-1 color=$vals[namefcolor] style=\"$vals[namefstyle]\">$names[$i]<\/a><\/font><\/td>\n<p>\n&#8220;); <br \/>\n  } <br \/>\n} <\/p>\n<p>#######################################################################  <br \/>\n#  Function:  double_horizontal_graph($names, $values, $bars,  <br \/>\n#                                     $vals, $dvalues, $dbars)  <br \/>\n#   Purpose:  Prints out the actual data for the double horizontal chart.  <br \/>\n#######################################################################  <br \/>\nfunction double_horizontal_graph($names,$values,$bars,$vals,$dvalues,$dbars)  <br \/>\n{ <br \/>\n  for( $i=0;$i<SizeOf($values);$i++ ) {  <br \/>\n  echo(&#8220;<TR><TD ALIGN=RIGHT \"); <br \/>\n  \/\/ If a background was choosen don&#8217;t print cell BGCOLOR <br \/>\n  if (! $vals[background]) { print &#8216; BGCOLOR=&#8221;&#8216; . $vals[namebgcolor] . &#8216;&#8221;&#8216;; } <br \/>\n  echo(&#8220;><FONT SIZE=-1 COLOR=$vals[namefcolor] STYLE=$vals[namefstyle]>$names[$i]<\/FONT><\/TD> <br \/>\n<TD  ALIGN=LEFT <br \/>\n&#8220;); <br \/>\n  \/\/ If a background was choosen don&#8217;t print cell BGCOLOR <br \/>\n  if (! $vals[background]) { print &#8216; BGCOLOR=&#8217; . $vals[valuebgcolor]; } <br \/>\n  $width = $dvalues[$i] * $vals[scale]; <br \/>\n  echo(&#8220;><TABLE ALIGN=LEFT CELLPADDING=0 CELLSPACING=0 WIDTH=$width> <br \/>\n<TR><TD \"); <br \/>\n  \/\/ Set background to a color if it starts with # or <br \/>\n  \/\/ an image otherwise. <br \/>\n  if (ereg(&#8220;^#&#8221;, $dbars[$i])) { print &#8216;BGCOLOR=&#8221;&#8216; . $dbars[$i] . &#8216;&#8221;>&#8217;; } <br \/>\n  else { print &#8216;BACKGROUND=&#8221;&#8216; . $dbars[$i] . &#8216;&#8221;>&#8217;; } <br \/>\n  echo(&#8220;<NOWRAP>&#8220;); <br \/>\n  \/\/ Decide if the value in bar is a color code or image. <br \/>\n  if (ereg(&#8220;^#&#8221;, $bars[$i])) {  <br \/>\n    $width = $values[$i] * $vals[scale]; <br \/>\n    echo(&#8220;<TABLE CELLPADDING=0 CELLSPACING=0 BGCOLOR=$bars[$i] WIDTH=$width> <br \/>\n<TR><TD>&#038;nbsp<\/TD><\/TR> <br \/>\n<\/TABLE><br \/>\n&#8220;); <br \/>\n            } else { <br \/>\n             print &#8216;<IMG SRC=\"' . $bars[$i] . '\"'; <br \/>\n             print &#8216; HEIGHT=10 WIDTH=&#8221;&#8216; . $values[$i] * $vals[scale] . &#8216;&#8221;>&#8217;; <br \/>\n            }           <\/p>\n<p>        if (! $vals[noshowvals]) { <br \/>\n            print &#8216;<I><FONT SIZE=\"-3\" COLOR=\"' . $vals[valuefcolor] . '\" '; <br \/>\n            print &#8216; STYLE=&#8221;&#8216; . $vals[valuefstyle] . &#8216;&#8221;>(&#8216;;  <br \/>\n            print $values[$i] . &#8220;)<\/FONT><\/I>&#8220;; <br \/>\n           } <br \/>\n?> <br \/>\n           <\/NOWRAP> <br \/>\n          <\/TD><\/TR> <br \/>\n         <\/TABLE> <br \/>\n<? <br \/>\n        if (! $vals[noshowvals]) <br \/>\n           { <br \/>\n            print &#8216;<I><FONT SIZE=\"-3\" COLOR=\"' . $vals[doublefcolor] . '\" '; <br \/>\n            print &#8216; STYLE=&#8221;&#8216; . $vals[valuefstyle] . &#8216;&#8221;>(&#8216;;  <br \/>\n            print $dvalues[$i] . &#8220;)<\/FONT><\/I>&#8220;; <br \/>\n           } <br \/>\n?> <br \/>\n        <\/TD>  <br \/>\n       <\/TR> <br \/>\n<? <br \/>\n       } \/\/ endfor <\/p>\n<p>   } \/\/ end double_horizontal_graph <\/p>\n<p>?> <\/p>\n<p>graph.php3\uc5d0\uc11c \uc704\uc758 \ud30c\uc77c\uc744 include\ud574\uc11c \uc544\ub798\uc5d0\uc11c \uc124\uc815\ub9cc \ud558\uba74<br \/>\n\uadf8\ub798\ud504\uac00 \ub098\uc640\uc11c \uc138\ub85c \ub9c9\ub300,\uac00\ub85c \ub9c9\ub300 \u314e\u314e\u314e\u314e\u314e\u314e<br \/>\n<?php<br \/>\n  if (!$html_graphs_included) {<br \/>\n    include(&#8220;html_graphs.php3&#8221;);<br \/>\n  }<\/p>\n<p>  $names   = array(&#8220;SDS&#8221;, &#8220;LG-EDS&#8221;, &#8220;DITCO&#8221;, &#8220;BIT&#8221;, &#8220;H&#038;C&#8221;, &#8220;Other&#8221;,&#8221;AAA&#8221;,&#8221;BBB&#8221;,&#8221;CCC&#8221;,&#8221;DDD&#8221;,&#8221;EEE&#8221;,&#8221;FFF&#8221;,&#8221;GGG&#8221;,&#8221;WWW&#8221;,&#8221;ZZZ&#8221;);<br \/>\n  $values  = array(1250,1100,1000,870,650,300,500,400,100,100,100,200,300,400,400);<br \/>\n  $largest = 1300;<\/p>\n<p>  $bars  = array();<\/p>\n<p>  for ($i = 0; $i < sizeof($values); $i++) {<br \/>\n    $bars[$i] = &#8220;bar.gif&#8221;;<br \/>\n  }<\/p>\n<p>  $graph_vals = array(<br \/>\n    &#8220;hlabel&#8221;=>&#8221;\uc740\ud589&#8221;,<br \/>\n    &#8220;vlabel&#8221;=>&#8221;\uc870\ud68c&#8221;,<br \/>\n    &#8220;type&#8221;=>1, \/\/ vertical graph<br \/>\n    &#8220;vfcolor&#8221;=>&#8221;#FFFFFF&#8221;,<br \/>\n    &#8220;hfcolor&#8221;=>&#8221;#FFFFFF&#8221;,<br \/>\n    &#8220;vbgcolor&#8221;=>&#8221;#000000&#8221;, \/\/\uc870\ud68c \ubc30\uacbd \uc0c9\uae54<br \/>\n    &#8220;hbgcolor&#8221;=>&#8221;#000000&#8221;, \/\/\uc740\ud589 \ubc30\uacbd \uc0c9\uae54<br \/>\n    &#8220;width&#8221;=>650,<br \/>\n    &#8220;cellspacing&#8221;=>&#8221;1&#8221;,<br \/>\n    &#8220;scale&#8221;=>150\/$largest,<br \/>\n        &#8220;valuebgcolor&#8221;=>&#8221;#F0E0DE&#8221;,    <br \/>\n    &#8220;namefcolor&#8221;=>&#8221;#FFFFFF&#8221;,<br \/>\n    &#8220;namebgcolor&#8221;=>&#8221;#000000&#8221;); \/\/x\ucd95 \ubc30\uacbd \uc0c9\uae54<\/p>\n<p>  html_graph($names, $values, $bars, $graph_vals);<br \/>\n  ?><\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc77c\ub2e8\uc740 html_graphs.php3 \uc758 \ub0b4\uc6a9\uc785\ub2c8\ub2e4.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[51],"tags":[],"class_list":["post-685","post","type-post","status-publish","format-standard","hentry","category-papa-php"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts\/685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=685"}],"version-history":[{"count":0,"href":"https:\/\/jblove.net\/index.php?rest_route=\/wp\/v2\/posts\/685\/revisions"}],"wp:attachment":[{"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jblove.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}