//////////////////////////////////////////////////////////////
///                                                         //
//  LastXgraph() by James Heinrich <info@silisoftware.com>  //
//        available at http://www.silisoftware.com          //
//                                                         ///
//////////////////////////////////////////////////////////////

What does LastXgraph() do?
==========================

Creates a PNG- (or GIF- or JPG-) format graph showing either:
  * Last-X-Days
  * Last-X-Months
  * Entire Month
  * Entire Year
  * 24-hour distribution
(to show the number for downloads, hits, etc. over the last 30
days, or to show what time of day/night the above hits occur, for
example). Looking at the demo (www.silisoftware.com) is the easiest
way to visualize what's being done. LastXgraph() can plot any number
of data values, both in terms of how many days back the graph goes,
and how many simultaneous values there are (for example, you could
plot hits, files & bytes on one graph). The other cool (but somewhat
processor-intensive) option is a bezier moving-average line of each
data set on the graph. The axis scales are auto-set based on the
maximum data values present.


Requirements
============
* PHP 4.0.0 or higher with:
  Ø GD 1.6 or higher (for PNG support)
  Ø GD 1.5 or lower  (for GIF support)
  Ø GD (any version) (for JPG support)
  Ø FreeType (for TrueType font support)


Usage
=====

LastXgraph() has many parameters, all of which are optional except for
the actual data to graph ($data):

* $data (required)
    This is the 2-dimensional array that contains the data to be
    graphed. The first dimension of the array is the name of the
    data set to be graphed, while the second dimension is the data
    values for that set.
        For example:  $data = array('Hits', 'Files', 'Bytes');
    and then each of those elements would also be a numeric-indexed
    array of values to be graphed. The first-dimension key names are
    used in the graph as data set labels (upper left corner)
    See $graphmethod description for more information.

* $graphmethod (optional - default: "24hourdistribution")
    This can be either "24hourdistribution", "pastxdays" or
    "pastxmonths".
    In pastxdays mode, there can be any number of data values, with
    numeric indices, where [0] is "today", [1] is "yesterday", [2] is
    "2 days ago", etc.
    In pastxdays mode, there can be any number of data values, with
    numeric indices, where [0] is "this month", [1] is "1 month ago",
    etc.
    In 24hourdistribution mode, [0] is midnight, [12] is noon, [23] is
    11pm, etc. There cannot be more than 24 2nd-dimension keys (0-23)
    in this mode.

* $title (optional - default: "Graph Title")
    The title at the top-right of the graph

* $scalelabel (optional - default: "axis label")
    The label for the vertical axis, written vertically, bottom-to-top

* $PlotAverage (optional - default: TRUE)
    If TRUE, the (somewhat processor-intensive) Bezier/DeCastleJau
    moving-average line is calculated and plotted for each data set

* $BezierPrecision (optional - default: 20)
    The number of points calculated between each data value for the
    moving-average line. The larger the number, the slower the plot,
    so increase this number with caution. 20-50 should be a decent
    balance of speed vs. smoothness, 100 should produce a nearly-
    perfect smooth line in most cases.

* $width (optional - default: 600)
    Width of the graph in pixels

* $height (optional - default: 300)
    Height of the graph in pixels

* $TTFfontfile (optional - default: "arial.ttf")
    Text on the graph is written with this TrueType font, which
    must be in the same directory as LastXgraph.php (or a pathname
    supplied as part of $TTFfontfile)

* $fontsize (optional - default: 11)
    More of a scaling factor than anything for the font sizes used
    on the graph - some fonts will actually be this size, but the
    various text elements are all scaled from this base size.

* $Yaxisdivs (optional - default: 10)
    Number of labels / divisions on the vertical axis

* $col_background (optional - default: "CCCCCC")
    HTML-hex colour for the background of the data area of the graph

* $col_border (optional - default: "000000")
    HTML-hex colour for the border colour of the entire graph,
    horizontal lines, and border of the data bars. This should be a
    contrasting colour to both $col_background and $col_text.

* $col_text (optional - default: "FFFFFF")
    HTML-hex colour for the text colour on the graph. This should be
    a contrasting colour to $col_border.

* $col_bars (optional - default: "3399FF;FF9933;FF0000;99FF33;FF33FF")
    Semi-colon-seperated array of HTML-hex colours for the data bars.
    Colours will be used in order (first data set gets the first
    colour, etc). There must be at least as many colours specified as
    there are data values, otherwise an error is generated (so with
    the default value, the graph can contain up to 5 data sets).