graphs.php
author Dan
Sat, 15 Nov 2008 15:38:21 -0500
changeset 28 a7e537c0b549
parent 19 eb92dc5d9fb4
child 43 ce2e9caf2dfa
permissions -rw-r--r--
Fix undefined $total in stats-fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     1
<?php
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     2
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     3
/*
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     4
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     5
 * Version 1.1.5 (Caoineag alpha 5)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     6
 * Copyright (C) 2006-2008 Dan Fuhry
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     7
 *
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     8
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
     9
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    10
 *
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    11
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    12
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    13
 */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    14
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    15
// BarGraph for PHP
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    16
// Source: http://www.phpclasses.org/browse/package/1567.html
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    17
// License: PHP license, see licenses/phplic.html included with this package
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    18
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    19
class GraphMaker {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    20
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    21
   * GraphMaker::bar_width
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    22
   * Width of bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    23
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    24
  var $bar_width = 32;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    25
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    26
   * GraphMaker::bar_height
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    27
   * Height of bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    28
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    29
  var $bar_height = 8;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    30
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    31
   * GraphMaker::bar_data
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    32
   * Data of all bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    33
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    34
  var $bar_data = array('a' => 7, 'b' => 3, 'c' => 6, 'd' => 0, 'e' => 2);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    35
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    36
   * GraphMaker::bar_padding
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    37
   * Padding of bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    38
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    39
  var $bar_padding = 5;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    40
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    41
   * GraphMaker::bar_bordercolor
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    42
   * Border color of bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    43
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    44
  var $bar_bordercolor = array(39, 78, 120);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    45
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    46
   * GraphMaker::bar_bgcolor
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    47
   * Background color of bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    48
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    49
  var $bar_bgcolor = array(69, 129, 194);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    50
  //---------------------------------------------
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    51
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    52
   * GraphMaker::graph_areaheight
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    53
   * Height of graphic area
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    54
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    55
  var $graph_areaheight = 100;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    56
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    57
   * GraphMaker::graph_padding
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    58
   * Paddings of graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    59
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    60
  var $graph_padding = array('left' => 50, 'top' => 20, 'right'  => 20, 'bottom' => 20);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    61
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    62
   * GraphMaker::graph_title
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    63
   * Title text of graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    64
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    65
  var $graph_title = "";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    66
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    67
   * GraphMaker::graph_bgcolor
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    68
   * Background color of graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    69
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    70
  var $graph_bgcolor = array(255, 255, 255);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    71
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    72
   * GraphMaker::graph_bgtransparent
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    73
   * Boolean for background transparency
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    74
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    75
  var $graph_bgtransparent = 0;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    76
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    77
   * GraphMaker::graph_transparencylevel
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    78
   * Transparency level (0=opaque, 127=transparent)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    79
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    80
  var $graph_transparencylevel = 0;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    81
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    82
   * GraphMaker::graph_borderwidth
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    83
   * Width of graph border
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    84
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    85
  var $graph_borderwidth = 1;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    86
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    87
   * GraphMaker::graph_bordercolor
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    88
   * Border color of graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    89
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    90
  var $graph_bordercolor = array(218, 218, 239);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    91
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    92
   * GraphMaker::graph_titlecolor
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    93
   * Color of title text of graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    94
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    95
  var $graph_titlecolor = array(99, 88, 78);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    96
  //---------------------------------------------
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    97
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    98
   * GraphMaker::axis_step
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
    99
   * Scale step of axis
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   100
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   101
  var $axis_step = 2;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   102
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   103
   * GraphMaker::axis_bordercolor
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   104
   * Border color of axis
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   105
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   106
  var $axis_bordercolor = array(99, 88, 78);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   107
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   108
   * GraphMaker::axis_bgcolor
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   109
   * Background color of axis
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   110
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   111
  var $axis_bgcolor = array(152, 137, 124);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   112
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   113
  /****************************************************************
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   114
                              GRAPH
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   115
  ****************************************************************/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   116
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   117
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   118
   * GraphMaker::SetGraphAreaHeight()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   119
   * Sets graph height (not counting top and bottom margins)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   120
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   121
  function SetGraphAreaHeight($height) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   122
    if ($height > 0) $this->graph_areaheight = $height;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   123
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   124
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   125
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   126
   * GraphMaker::SetGraphPadding()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   127
   * Sets graph padding (margins)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   128
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   129
  function SetGraphPadding($left, $top, $right, $bottom) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   130
    $this->graph_padding = array('left'   => (int) $left,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   131
                                 'top'    => (int) $top,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   132
                                 'right'  => (int) $right,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   133
                                 'bottom' => (int) $bottom);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   134
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   135
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   136
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   137
   * GraphMaker::SetGraphTitle()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   138
   * Set title text
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   139
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   140
  function SetGraphTitle($title) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   141
    $this->graph_title = $title;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   142
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   143
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   144
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   145
   * GraphMaker::SetGraphBorderColor()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   146
   * Sets border color for graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   147
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   148
  function SetGraphBorderColor($red, $green, $blue) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   149
    $this->graph_bordercolor = array($red, $green, $blue);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   150
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   151
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   152
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   153
   * GraphMaker::SetGraphBorderWidth()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   154
   * Set width of border. 0 disables border
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   155
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   156
  function SetGraphBorderWidth($width = 0) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   157
    $this->graph_borderwidth = $width;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   158
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   159
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   160
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   161
   * GraphMaker::SetGraphBackgroundColor()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   162
   * Sets background color for graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   163
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   164
  function SetGraphBackgroundColor($red, $green, $blue) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   165
    $this->graph_bgcolor = array($red, $green, $blue);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   166
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   167
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   168
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   169
   * GraphMaker::SetGraphBackgroundTransparent()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   170
   * Sets background color for graph (and set it transparent)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   171
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   172
  function SetGraphBackgroundTransparent($red, $green, $blue, $addtransparency = 1) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   173
    $this->graph_bgcolor = array($red, $green, $blue);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   174
    $this->graph_bgtransparent = ($addtransparency ? 1 : 0);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   175
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   176
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   177
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   178
   * GraphMaker::SetGraphTitleColor()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   179
   * Sets title color for graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   180
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   181
  function SetGraphTitleColor($red, $green, $blue) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   182
    $this->graph_titlecolor = array($red, $green, $blue);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   183
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   184
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   185
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   186
   * GraphMaker::SetGraphTransparency()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   187
   * Sets transparency for graph
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   188
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   189
  function SetGraphTransparency($percent) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   190
    if ($percent < 0) $percent = 0;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   191
    elseif ($percent > 100) $percent = 127;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   192
    else $percent = $percent * 1.27;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   193
    $this->graph_transparencylevel = $percent;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   194
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   195
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   196
  /****************************************************************
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   197
                               BAR
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   198
  ****************************************************************/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   199
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   200
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   201
   * GraphMaker::SetBarBorderColor()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   202
   * Sets border color for bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   203
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   204
  function SetBarBorderColor($red, $green, $blue) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   205
    $this->bar_bordercolor = array($red, $green, $blue);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   206
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   207
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   208
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   209
   * GraphMaker::SetBarBackgroundColor()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   210
   * Sets background color for bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   211
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   212
  function SetBarBackgroundColor($red, $green, $blue) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   213
    $this->bar_bgcolor = array($red, $green, $blue);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   214
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   215
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   216
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   217
   * GraphMaker::SetBarData()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   218
   * Sets data of graph (parameter should be an array with key
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   219
   * being the name of the bar and the value the value of the bar.
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   220
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   221
  function SetBarData($data) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   222
    if (is_array($data)) $this->bar_data = $data;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   223
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   224
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   225
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   226
   * GraphMaker::SetBarDimensions()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   227
   * Sets with and height of each bar
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   228
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   229
  function SetBarDimensions($width, $height) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   230
    if ($width > 0) $this->bar_width = $width;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   231
    if ($height > 0) $this->bar_height = $height;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   232
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   233
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   234
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   235
   * GraphMaker::SetBarPadding()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   236
   * Sets padding (border) around each bar
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   237
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   238
  function SetBarPadding($padding) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   239
    if ($padding > 0) $this->bar_padding = $padding;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   240
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   241
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   242
  /****************************************************************
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   243
                               AXIS
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   244
  ****************************************************************/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   245
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   246
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   247
   * GraphMaker::SetAxisBorderColor()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   248
   * Sets border color for axis
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   249
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   250
  function SetAxisBorderColor($red, $green, $blue) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   251
    $this->axis_bordercolor = array($red, $green, $blue);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   252
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   253
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   254
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   255
   * GraphMaker::SetAxisBackgroundColor()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   256
   * Sets background color for axis
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   257
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   258
  function SetAxisBackgroundColor($red, $green, $blue) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   259
    $this->axis_bgcolor = array($red, $green, $blue);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   260
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   261
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   262
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   263
   * GraphMaker::SetAxisStep()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   264
   * Sets axis scale step
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   265
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   266
  function SetAxisStep($step) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   267
    if ($step > 0) $this->axis_step = $step;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   268
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   269
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   270
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   271
   * GraphMaker::GetFinalGraphDimensions()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   272
   * From the values already setted, it calculates image
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   273
   * width and height
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   274
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   275
  function GetFinalGraphDimensions() {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   276
    $w = $this->graph_padding['left'] +
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   277
         (count($this->bar_data) * ($this->bar_width + ($this->bar_padding * 2))) +
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   278
         $this->graph_padding['right'];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   279
    $h = $this->graph_padding['top'] +
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   280
         $this->graph_areaheight +
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   281
         $this->graph_padding['bottom'];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   282
    return array($w, $h);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   283
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   284
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   285
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   286
   * GraphMaker::LoadGraph()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   287
   * Loads definitions from a file
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   288
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   289
  function LoadGraph($path) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   290
    if (($fp = @fopen($path, "r")) !== false) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   291
      $content = "";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   292
      while (!feof($fp)) {              // I do not use filesize() here
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   293
        $content .= fread($fp, 4096);   // because of remote files. If
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   294
      }                                 // there is no problem with them
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   295
      fclose($fp);                      // please let me know
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   296
      $this->__LoadGraphDefinitions($content);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   297
      return true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   298
    } else return false;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   299
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   300
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   301
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   302
   * GraphMaker::DrawGraph()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   303
   * Draw all the graph: bg, axis, bars, text.. and output it
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   304
   * Optional file parameter turns output to file, and bool on success
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   305
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   306
  function DrawGraph($file = "") {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   307
    list($w, $h) = $this->GetFinalGraphDimensions();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   308
    $this->graph_width = $w;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   309
    $this->graph_height = $h;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   310
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   311
    $this->im = imagecreatetruecolor($w, $h);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   312
    if ($this->graph_transparencylevel) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   313
      imagealphablending($this->im, true);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   314
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   315
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   316
    $this->__PaintBackground();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   317
    $this->__DrawAxis();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   318
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   319
    $p = 0;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   320
    foreach ($this->bar_data as $name => $value) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   321
      $p++;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   322
      $this->__DrawBarText($p, $name);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   323
      $this->__DrawBar($p, $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   324
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   325
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   326
    if (strlen($this->graph_title)) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   327
      $this->__AllocateColor("im_graph_titlecolor",
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   328
                             $this->graph_titlecolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   329
                             $this->graph_transparencylevel);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   330
      $this->__DrawText($this->graph_title,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   331
                        floor($this->graph_width / 2),
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   332
                        $this->graph_borderwidth + 2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   333
                        $this->im_graph_titlecolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   334
                        2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   335
                        1);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   336
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   337
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   338
    if (strlen($file)) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   339
      $ret = imagepng($this->im, $file);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   340
    } else {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   341
      header('Content-Type: image/png');
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   342
      imagepng($this->im);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   343
      $ret = true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   344
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   345
    imagedestroy($this->im);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   346
    return $ret;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   347
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   348
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   349
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   350
   * GraphMaker::PaintBackground()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   351
   * Draw all the graph: bg, axis, bars, text.. and output it
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   352
   * Optional file parameter turns output to file, and bool on success
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   353
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   354
  function __PaintBackground() {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   355
    $this->__AllocateColor("im_graph_bgcolor",
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   356
                           $this->graph_bgcolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   357
                           0);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   358
    imagefilledrectangle($this->im,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   359
                         0,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   360
                         0,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   361
                         $this->graph_width,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   362
                         $this->graph_height,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   363
                         $this->im_graph_bgcolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   364
    if ($this->graph_bgtransparent) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   365
      imagecolortransparent($this->im, $this->im_graph_bgcolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   366
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   367
    if ($this->graph_borderwidth) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   368
      $this->__AllocateColor("im_graph_bordercolor",
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   369
                             $this->graph_bordercolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   370
                             $this->graph_transparencylevel);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   371
      for ($i = 0; $i < $this->graph_borderwidth; $i++) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   372
        imagerectangle($this->im,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   373
                       $i,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   374
                       $i,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   375
                       $this->graph_width - 1 - $i,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   376
                       $this->graph_height - 1 - $i,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   377
                       $this->im_graph_bordercolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   378
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   379
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   380
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   381
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   382
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   383
   * GraphMaker::__DrawAxis()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   384
   * Draws all the axis stuff (and scale steps)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   385
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   386
  function __DrawAxis() {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   387
    $this->__AllocateColor("im_axis_bordercolor",
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   388
                           $this->axis_bordercolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   389
                           $this->graph_transparencylevel);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   390
    $this->__AllocateColor("im_axis_bgcolor",
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   391
                           $this->axis_bgcolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   392
                           $this->graph_transparencylevel);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   393
    $this->__DrawPolygon($this->graph_padding['left'], $this->graph_height - $this->graph_padding['bottom'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   394
                         $this->graph_padding['left'], $this->graph_padding['top'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   395
                         $this->graph_padding['left'] + $this->bar_height - 1, $this->graph_padding['top'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   396
                         $this->graph_padding['left'] + $this->bar_height - 1, $this->graph_height - $this->graph_padding['bottom'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   397
                         $this->im_axis_bgcolor, true);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   398
    $this->__DrawPolygon($this->graph_padding['left'], $this->graph_height - $this->graph_padding['bottom'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   399
                         $this->graph_padding['left'], $this->graph_padding['top'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   400
                         $this->graph_padding['left'] + $this->bar_height - 1, $this->graph_padding['top'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   401
                         $this->graph_padding['left'] + $this->bar_height - 1, $this->graph_height - $this->graph_padding['bottom'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   402
                         $this->im_axis_bordercolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   403
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   404
    $this->__DrawPolygon($this->graph_padding['left'], $this->graph_height - $this->graph_padding['bottom'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   405
                         $this->graph_padding['left'] + $this->bar_height - 1, $this->graph_height - $this->graph_padding['bottom'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   406
                         $this->graph_width - $this->graph_padding['right'] + $this->bar_height - 1, $this->graph_height - $this->graph_padding['bottom'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   407
                         $this->graph_width - $this->graph_padding['right'], $this->graph_height - $this->graph_padding['bottom'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   408
                         $this->im_axis_bgcolor, true);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   409
    $this->__DrawPolygon($this->graph_padding['left'], $this->graph_height - $this->graph_padding['bottom'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   410
                         $this->graph_padding['left'] + $this->bar_height - 1, $this->graph_height - $this->graph_padding['bottom'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   411
                         $this->graph_width - $this->graph_padding['right'] + $this->bar_height - 1, $this->graph_height - $this->graph_padding['bottom'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   412
                         $this->graph_width - $this->graph_padding['right'], $this->graph_height - $this->graph_padding['bottom'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   413
                         $this->im_axis_bordercolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   414
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   415
    // draw lines that separate bars
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   416
    $total_bars = count($this->bar_data);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   417
    for ($i = 1; $i < $total_bars; $i++) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   418
      $offset = $this->graph_padding['left'] +
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   419
                (($this->bar_width + ($this->bar_padding * 2)) * $i);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   420
      imageline($this->im,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   421
                $offset,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   422
                $this->graph_height - $this->graph_padding['bottom'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   423
                $offset + $this->bar_height - 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   424
                $this->graph_height - $this->graph_padding['bottom'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   425
                $this->im_axis_bordercolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   426
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   427
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   428
    // draw scale steps
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   429
    $max_value = $this->__GetMaxGraphValue();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   430
    if (($max_value % 10) > 0) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   431
      $max_value = $max_value + (10 - ($max_value % 10));
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   432
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   433
    $this->axis_max = $max_value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   434
    $y = 0;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   435
    $style = array($this->im_axis_bordercolor, $this->im_graph_bgcolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   436
    imagesetstyle($this->im, $style);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   437
    while ($y <= $max_value) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   438
      if ($max_value == 0) { $max_value=1; } // corrected by Marcelo Trenkenchu
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   439
      $offset = floor($this->graph_height - $this->graph_padding['bottom'] -
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   440
                ($y * $this->graph_areaheight / $max_value));
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   441
      imageline($this->im,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   442
                $this->graph_padding['left'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   443
                $offset,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   444
                $this->graph_padding['left'] + $this->bar_height - 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   445
                $offset - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   446
                $this->im_axis_bordercolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   447
      $this->__DrawText($y,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   448
                        $this->graph_padding['left'],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   449
                        $offset,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   450
                        $this->im_axis_bordercolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   451
                        1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   452
                        2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   453
                        1);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   454
      // gridline
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   455
      if ($y > 0) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   456
        imageline($this->im,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   457
                  $this->graph_padding['left'] + $this->bar_height,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   458
                  $offset - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   459
                  $this->graph_width - $this->graph_padding['right'] + $this->bar_height - 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   460
                  $offset - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   461
                  IMG_COLOR_STYLED);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   462
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   463
      $y += $this->axis_step;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   464
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   465
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   466
    imageline($this->im,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   467
              $this->graph_width - $this->graph_padding['right'] + $this->bar_height - 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   468
              $this->graph_padding['top'] - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   469
              $this->graph_width - $this->graph_padding['right'] + $this->bar_height - 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   470
              $this->graph_height - $this->graph_padding['bottom'] - $this->bar_height,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   471
              IMG_COLOR_STYLED);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   472
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   473
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   474
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   475
   * GraphMaker::__DrawText()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   476
   * Draws text on image with color, size and alignment options
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   477
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   478
  function __DrawText($text, $x, $y, $color, $size = 1, $align = 0, $valign = 0) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   479
    /*
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   480
     * Align: 0=left | 1=center | 2=right
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   481
     */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   482
    if ($align == 1) $x -= floor(strlen($text) * imagefontwidth($size) / 2);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   483
    elseif ($align == 2) $x -= (strlen($text) * imagefontwidth($size));
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   484
    if ($valign == 1) $y -= floor(imagefontheight($size) / 2);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   485
    elseif ($valign == 2) $y -= imagefontheight($size);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   486
    imagestring($this->im,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   487
                $size,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   488
                $x,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   489
                $y,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   490
                $text,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   491
                $color);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   492
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   493
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   494
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   495
   * GraphMaker::__GetMaxGraphValue()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   496
   * Returns max bar value
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   497
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   498
  function __GetMaxGraphValue() {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   499
    $max_value = 0;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   500
    foreach ($this->bar_data as $name => $value) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   501
      if ($value > $max_value) $max_value = $value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   502
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   503
    return $max_value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   504
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   505
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   506
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   507
   * GraphMaker::__DrawBarText()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   508
   * Determines top and left to draw text to a choosen bar
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   509
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   510
  function __DrawBarText($bar, $text) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   511
    $this->__DrawText($text,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   512
                      $this->graph_padding['left'] + (($this->bar_width + ($this->bar_padding * 2)) * ($bar - 0.5)),
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   513
                      $this->graph_height - $this->graph_padding['bottom'] + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   514
                      $this->axis_bordercolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   515
                      1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   516
                      1);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   517
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   518
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   519
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   520
   * GraphMaker::__DrawBar()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   521
   * Draws a choosen bar with it's value
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   522
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   523
  function __DrawBar($bar, $value) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   524
    $x = $this->graph_padding['left'] +
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   525
         (($this->bar_width + ($this->bar_padding * 2)) * ($bar - 1)) +
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   526
         $this->bar_padding;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   527
    if ($this->axis_max == 0) { $this->axis_max = 1; } // corrected by Marcelo Trenkenchu
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   528
    $y = $value * $this->graph_areaheight / $this->axis_max;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   529
    $this->____DrawBar($x,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   530
                       $this->graph_height - $this->graph_padding['bottom'] - $y,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   531
                       $x + $this->bar_width,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   532
                       $this->graph_height - $this->graph_padding['bottom']);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   533
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   534
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   535
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   536
   * GraphMaker::____DrawBar()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   537
   * Draws the actual rectangles that form a bar
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   538
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   539
  function ____DrawBar($x1, $y1, $x2, $y2) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   540
    $this->__AllocateColor("im_bar_bordercolor",
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   541
                           $this->bar_bordercolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   542
                           $this->graph_transparencylevel);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   543
    $this->__AllocateColor("im_bar_bgcolor",
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   544
                           $this->bar_bgcolor,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   545
                           $this->graph_transparencylevel);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   546
    $this->__DrawPolygon($x1,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   547
                         $x2,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   548
                         $x2,                         $y2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   549
                         $x1,                         $y2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   550
                         $this->im_bar_bgcolor,       true);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   551
    $this->__DrawPolygon($x1,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   552
                         $x2,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   553
                         $x2,                         $y2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   554
                         $x1,                         $y2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   555
                         $this->im_bar_bordercolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   556
    $this->__DrawPolygon($x1,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   557
                         $x2,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   558
                         $x2 + $this->bar_height - 1, $y1 - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   559
                         $x1 + $this->bar_height - 1, $y1 - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   560
                         $this->im_bar_bgcolor,       true);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   561
    $this->__DrawPolygon($x1,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   562
                         $x2,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   563
                         $x2 + $this->bar_height - 1, $y1 - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   564
                         $x1 + $this->bar_height - 1, $y1 - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   565
                         $this->im_bar_bordercolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   566
    $this->__DrawPolygon($x2,                         $y2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   567
                         $x2,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   568
                         $x2 + $this->bar_height - 1, $y1 - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   569
                         $x2 + $this->bar_height - 1, $y2 - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   570
                         $this->im_bar_bgcolor,       true);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   571
    $this->__DrawPolygon($x2,                         $y2,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   572
                         $x2,                         $y1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   573
                         $x2 + $this->bar_height - 1, $y1 - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   574
                         $x2 + $this->bar_height - 1, $y2 - $this->bar_height + 1,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   575
                         $this->im_bar_bordercolor);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   576
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   577
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   578
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   579
   * GraphMaker::__DrawPolygon()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   580
   * Draws a (filled) (ir)regular polygon
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   581
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   582
  function __DrawPolygon($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4, $color, $filled = false) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   583
    if ($filled) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   584
      imagefilledpolygon($this->im, array($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4), 4, $color);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   585
    } else {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   586
      imagepolygon($this->im, array($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4), 4, $color);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   587
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   588
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   589
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   590
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   591
   * GraphMaker::__LoadGraphDefinitions()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   592
   * Loads definitions to a graph from text lines (normaly
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   593
   * they come from a file). This function is called by
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   594
   * GraphMaker::LoadGraph()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   595
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   596
  function __LoadGraphDefinitions($text) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   597
    $text = preg_split("/\r?\n/", $text);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   598
    $data = array();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   599
    $section = '';
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   600
    for ($i = 0; $i < count($text); $i++) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   601
      if (preg_match("/^\s*#/", $text[$i])) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   602
        //ignore.. it's just a comment
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   603
      } elseif (preg_match("/^\s*\}\s*/", $text[$i])) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   604
        $section = '';
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   605
      } elseif (preg_match("/^\s*(\w+)\s*\{\s*$/", $text[$i], $r)) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   606
        $section = $r[1];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   607
      } else {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   608
        $p = strpos($text[$i], "=");
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   609
        if ($p !== false) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   610
          $data[$section][trim(substr($text[$i], 0, $p))] = trim(substr($text[$i], $p + 1));
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   611
        }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   612
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   613
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   614
    if (is_array($data['graph'])) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   615
      $this->__LoadGraphValues($data['graph']);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   616
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   617
    if (is_array($data['bar'])) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   618
      $this->__LoadBarValues($data['bar']);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   619
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   620
    if (is_array($data['axis'])) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   621
      $this->__LoadAxisValues($data['axis']);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   622
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   623
    if (is_array($data['data'])) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   624
      $this->bar_data = $data['data'];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   625
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   626
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   627
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   628
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   629
   * GraphMaker::__LoadGraphValues()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   630
   * Loads definitions to main graph settings
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   631
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   632
  function __LoadGraphValues($data) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   633
    foreach ($data as $name => $value) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   634
      $name = strtolower($name);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   635
      switch ($name) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   636
        case 'background-color':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   637
          $this->__SetColorToValue("graph_bgcolor", $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   638
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   639
        case 'border-color':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   640
          $this->__SetColorToValue("graph_bordercolor", $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   641
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   642
        case 'title-color':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   643
          $this->__SetColorToValue("graph_titlecolor", $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   644
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   645
        case 'background-transparent':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   646
          $this->graph_bgtransparent = ($value == 1 || $value == 'yes' ? 1 : 0);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   647
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   648
        case 'transparency':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   649
          $this->SetGraphTransparency(str_replace('%', '', $value));
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   650
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   651
        case 'title':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   652
          $this->graph_title = $value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   653
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   654
        case 'border-width':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   655
          $this->graph_borderwidth = (int) $value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   656
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   657
        case 'area-height':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   658
          $this->graph_areaheight = (int) $value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   659
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   660
        default:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   661
          if (substr($name, 0, 8) == 'padding-' && strlen($name) > 8) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   662
            $this->graph_padding[substr($name, 8)] = $value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   663
          }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   664
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   665
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   666
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   667
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   668
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   669
   * GraphMaker::__LoadBarValues()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   670
   * Loads definitions to bar settings
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   671
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   672
  function __LoadBarValues($data) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   673
    foreach ($data as $name => $value) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   674
      $name = strtolower($name);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   675
      switch ($name) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   676
        case 'background-color':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   677
          $this->__SetColorToValue("bar_bgcolor", $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   678
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   679
        case 'border-color':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   680
          $this->__SetColorToValue("bar_bordercolor", $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   681
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   682
        case 'padding':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   683
          $this->bar_padding = $value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   684
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   685
        case 'width':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   686
          $this->bar_width = (int) $value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   687
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   688
        case 'height':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   689
          $this->bar_height = (int) $value;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   690
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   691
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   692
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   693
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   694
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   695
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   696
   * GraphMaker::__LoadAxisValues()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   697
   * Loads definitions to axis settings
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   698
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   699
  function __LoadAxisValues($data) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   700
    foreach ($data as $name => $value) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   701
      switch (strtolower($name)) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   702
        case 'step':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   703
          $this->SetAxisStep($value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   704
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   705
        case 'background-color':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   706
          $this->__SetColorToValue("axis_bgcolor", $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   707
          break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   708
        case 'border-color':
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   709
          $this->__SetColorToValue("axis_bordercolor", $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   710
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   711
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   712
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   713
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   714
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   715
   * GraphMaker::__SetColorToValue()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   716
   * Sets a color (rgb or in html format) to a variable
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   717
   **/
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   718
  function __SetColorToValue($varname, $color) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   719
    if ($color[0] == "#") { // if it's hex (html format), change to rgb array
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   720
      if (strlen($color) == 4) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   721
        // if only 3 hex values (I assume it's a shade of grey: #ddd)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   722
        $color .= substr($color, -3);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   723
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   724
      $color = array(hexdec($color[1].$color[2]),
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   725
                     hexdec($color[3].$color[4]),
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   726
                     hexdec($color[5].$color[6]));
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   727
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   728
    $this->$varname = $color;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   729
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   730
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   731
  function __AllocateColor($varname, $color, $alpha) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   732
    $this->$varname = imagecolorallocatealpha($this->im,
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   733
                                              $color[0],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   734
                                              $color[1],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   735
                                              $color[2],
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   736
                                              $alpha);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   737
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   738
}
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   739
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   740
// Graph Generator for PHP
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   741
// Originally located at http://szewo.com/php/graph, but link was broken, so this file was retrieved from:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   742
// http://web.archive.org/web/20030130065944/szewo.com/php/graph/graph.class.php3.txt
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   743
// License unknown, however sources on the web have shown this to be either GPL or public domain.
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   744
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   745
// At this point this class has been very nearly rewritten for Enano.
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   746
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   747
class GraphMaker_compat {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   748
  var $_values;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   749
  var $_ShowLabels;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   750
  var $_ShowCounts;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   751
  var $_ShowCountsMode;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   752
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   753
  var $_BarWidth;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   754
  var $_GraphWidth;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   755
  var $_BarImg;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   756
  var $_BarBorderWidth;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   757
  var $_BarBorderColor;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   758
  var $_BarBackgroundColor;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   759
  var $_RowSortMode;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   760
  var $_TDClassHead;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   761
  var $_TDClassLabel;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   762
  var $_TDClassCount;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   763
  var $_GraphTitle;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   764
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   765
  function __construct() {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   766
    $this->_values = array();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   767
    $this->_ShowLabels = true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   768
    $this->_BarWidth = 32;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   769
    $this->_GraphWidth = 360;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   770
    $this->_BarImg = scriptPath . "/images/graphbit.png";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   771
    $this->_BarBorderWidth = 0;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   772
    $this->_BarBorderColor = "red";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   773
    $this->_ShowCountsMode = 2;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   774
    $this->_RowSortMode = 1;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   775
    $this->_TDClassHead = "graph-title";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   776
    $this->_TDClassLabel = "graph-label";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   777
    $this->_TDClassCount = "graph-count";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   778
    $this->_GraphTitle="Graph title";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   779
    $this->_BarBackgroundColor = "#456798";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   780
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   781
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   782
  function GraphMaker_compat() {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   783
    $this->__construct();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   784
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   785
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   786
  function SetBarBorderWidth($width) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   787
    $this->_BarBorderWidth = $width;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   788
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   789
  function SetBorderColor($color) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   790
    $this->_BarBorderColor = $color;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   791
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   792
  
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   793
  function SetBarBackgroundColor($color)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   794
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   795
    $this->_BarBackgroundColor = $color;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   796
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   797
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   798
//  mode = 1 labels asc, 2 label desc
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   799
  function SetSortMode($mode) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   800
    switch ($mode) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   801
      case 1:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   802
        asort($this->_values);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   803
        break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   804
      case 2:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   805
        arsort($this->_values);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   806
        break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   807
      default:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   808
        break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   809
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   810
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   811
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   812
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   813
  function AddValue($labelName, $theValue) {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   814
    array_push($this->_values, array("label" => $labelName, "value" => $theValue));
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   815
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   816
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   817
  function SetBarData($data)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   818
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   819
      foreach ( $data as $name => $value )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   820
      {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   821
          $this->AddValue($name, $value);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   822
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   823
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   824
  function DrawGraph()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   825
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   826
      $this->BarGraphVert();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   827
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   828
  function SetBarWidth($width)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   829
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   830
    $this->_BarWidth = $width;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   831
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   832
  function SetBarImg($img)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   833
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   834
    $this->_BarImg = $img;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   835
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   836
  function SetShowLabels($lables)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   837
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   838
    $this->_ShowLabels = $labels;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   839
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   840
  function SetGraphWidth($width)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   841
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   842
    $this->_GraphWidth = $width;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   843
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   844
  function SetGraphTitle($title)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   845
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   846
    $this->_GraphTitle = $title;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   847
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   848
  //mode = percentage or counts
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   849
  function SetShowCountsMode($mode)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   850
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   851
    $this->_ShowCountsMode = $mode;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   852
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   853
  //mode = none(0) label(1) or count(2)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   854
  function SetRowSortMode($sortmode)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   855
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   856
    $this->_RowSortMode = $sortmode;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   857
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   858
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   859
  function SetTDClassHead($class)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   860
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   861
    $this->_TDClassHead = $class;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   862
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   863
  function SetTDClassLabel($class)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   864
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   865
    $this->_TDClassLabel = $class;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   866
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   867
  function SetTDClassCount($class)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   868
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   869
    $this->_TDClassCount = $class;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   870
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   871
  function GetMaxVal()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   872
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   873
    $maxval = 0;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   874
    foreach ( $this->_values as $value )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   875
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   876
      if ( $maxval < $value["value"] )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   877
      {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   878
        $maxval = $value["value"];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   879
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   880
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   881
    return $maxval;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   882
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   883
  function BarGraphVert()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   884
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   885
    $maxval = $this->GetMaxVal();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   886
    foreach($this->_values as $value)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   887
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   888
      $sumval += $value["value"];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   889
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   890
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   891
    $this->SetSortMode($this->_RowSortMode);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   892
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   893
    echo "\n<!-- ----------------------------------------- -->\n<div class=\"tblholder\" style=\"width: 100%; clip: rect(0px,auto,auto,0px); overflow: auto;\">\n<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\">\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   894
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   895
    if ( strlen($this->_GraphTitle) > 0 )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   896
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   897
      echo "<tr>\n    <th colspan=\"".count($this->_values)."\" class=\"".$this->_TDClassHead."\">".$this->_GraphTitle."</th>\n  </tr>\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   898
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   899
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   900
    echo "<tr>\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   901
    $css_class = 'row1';
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   902
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   903
    foreach($this->_values as $value)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   904
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   905
      $css_class = ( $css_class == 'row1' ) ? 'row3' : 'row1';
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   906
      echo "  <td valign=\"bottom\" align=\"center\" class=\"$css_class\">\n      ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   907
      $width = $this->_BarWidth;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   908
      $height = ceil( $value["value"] * $this->_GraphWidth / $maxval );
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   909
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   910
      echo "<div style=\"width: {$width}px; height: {$height}px; background-color: {$this->_BarBackgroundColor}; border: ".$this->_BarBorderWidth."px solid ".$this->_BarBorderColor."\">\n      ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   911
      echo "</div>\n    ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   912
      
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   913
      // echo "<img src=\"".$this->_BarImg."\" height=\"$width\" width=\"$height\" ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   914
      // echo "  style=\"border: ".$this->_BarBorderWidth."px solid ".$this->_BarBorderColor."\"";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   915
      // echo ">";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   916
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   917
      echo "</td>\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   918
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   919
    echo "</tr>\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   920
    if ( $this->_ShowCountsMode > 0 )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   921
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   922
      $css_class = 'row1';
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   923
      echo "<tr>\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   924
      foreach($this->_values as $value)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   925
      {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   926
        $css_class = ( $css_class == 'row1' ) ? 'row3' : 'row1';
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   927
        switch ($this->_ShowCountsMode)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   928
        {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   929
          case 1:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   930
            $count = round ( 100 * $value["value"] / $sumval ) . "%";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   931
            break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   932
          case 2:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   933
            $count = $value["value"];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   934
            break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   935
          default:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   936
            break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   937
        }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   938
        echo "  <td align=\"center\" class=\"$css_class ".$this->_TDClassCount."\">$count</td>\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   939
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   940
      echo "</tr>\n";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   941
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   942
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   943
    if ($this->_ShowLabels)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   944
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   945
      $css_class = 'row1';
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   946
      echo "  <tr>\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   947
      foreach($this->_values as $value)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   948
      {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   949
        $css_class = ( $css_class == 'row1' ) ? 'row3' : 'row1';
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   950
        echo "  <td align=\"center\" class=\"$css_class ".$this->_TDClassLabel."\"";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   951
        echo ">".$value["label"]."</td>\n  ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   952
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   953
      echo "</tr>\n";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   954
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   955
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   956
    echo "</table>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   957
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   958
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   959
  function BarGraphHoriz()
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   960
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   961
    $maxval = $this->GetMaxVal();
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   962
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   963
    foreach($this->_values as $value)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   964
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   965
      $sumval += $value["value"];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   966
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   967
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   968
    $this->SetSortMode($this->_RowSortMode);
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   969
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   970
    echo "<table border=\"0\">";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   971
    
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   972
    if ( strlen($this->_GraphTitle) > 0 )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   973
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   974
      echo "<tr><td ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   975
      if ( $this->_ShowCountsMode > 0 )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   976
      {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   977
        echo " colspan=\"2\"";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   978
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   979
      echo " class=\"".$this->_TDClassHead."\">".$this->_GraphTitle."</td></tr>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   980
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   981
    foreach($this->_values as $value)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   982
    {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   983
      if ($this->_ShowLabels)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   984
      {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   985
        echo "<tr>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   986
        echo "<td class=\"".$this->_TDClassLabel."\"";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   987
        if ( $this->_ShowCountsMode > 0 )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   988
        {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   989
          echo " colspan=\"2\"";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   990
        }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   991
        echo ">".$value["label"]."</td></tr>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   992
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   993
      echo "<tr>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   994
      if ( $this->_ShowCountsMode > 0 )
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   995
      {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   996
        switch ($this->_ShowCountsMode)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   997
        {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   998
          case 1:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
   999
            $count = round(100 * $value["value"] / $sumval )."%";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1000
            break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1001
          case 2:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1002
            $count = $value["value"];
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1003
            break;  /* Exit the switch and the while. */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1004
          default:
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1005
            break;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1006
        }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1007
        echo "<td class=\"".$this->_TDClassCount."\">$count</TD>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1008
      }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1009
      echo "<td>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1010
      $height = $this->_BarWidth;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1011
      $width = ceil( $value["value"] * $this->_GraphWidth / $maxval );
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1012
      echo "<div style=\"width: {$width}px; height: {$height}px; background-color: #456798; border: ".$this->_BarBorderWidth."px solid ".$this->_BarBorderColor."\">\n      ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1013
      echo "</div>\n    ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1014
      //echo "<img SRC=\"".$this->_BarImg."\" height=$height width=$width ";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1015
      //echo "  style=\"border: ".$this->_BarBorderWidth."px solid ".$this->_BarBorderColor."\"";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1016
      //echo ">";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1017
      echo "</td></tr>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1018
    }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1019
    echo "</table>";
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1020
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1021
  /**
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1022
   * Dummy functions for compatibility with the GD version of the class
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1023
   */
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1024
  
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1025
  function SetGraphPadding($a, $b, $c, $d)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1026
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1027
    return true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1028
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1029
  function SetBarPadding($a)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1030
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1031
    return true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1032
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1033
  function SetAxisStep($a)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1034
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1035
    return true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1036
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1037
  function SetGraphBackgroundTransparent($r, $g, $b, $a)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1038
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1039
    return true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1040
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1041
  function SetGraphTransparency($a)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1042
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1043
    return true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1044
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1045
  function SetGraphAreaHeight($a)
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1046
  {
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1047
    return true;
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1048
  }
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1049
}
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1050
eb92dc5d9fb4 Can't believe I never put graphs.php in there.
Dan
parents:
diff changeset
  1051