aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.2/src/libchart/classes
diff options
context:
space:
mode:
Diffstat (limited to 'boca-1.5.2/src/libchart/classes')
-rw-r--r--boca-1.5.2/src/libchart/classes/Axis.php167
-rw-r--r--boca-1.5.2/src/libchart/classes/BarChart.php172
-rw-r--r--boca-1.5.2/src/libchart/classes/Chart.php213
-rw-r--r--boca-1.5.2/src/libchart/classes/Color.php74
-rw-r--r--boca-1.5.2/src/libchart/classes/HorizontalChart.php169
-rw-r--r--boca-1.5.2/src/libchart/classes/LineChart.php171
-rw-r--r--boca-1.5.2/src/libchart/classes/PieChart.php386
-rw-r--r--boca-1.5.2/src/libchart/classes/Point.php83
-rw-r--r--boca-1.5.2/src/libchart/classes/Primitive.php59
-rw-r--r--boca-1.5.2/src/libchart/classes/Text.php139
-rw-r--r--boca-1.5.2/src/libchart/classes/VerticalChart.php169
11 files changed, 0 insertions, 1802 deletions
diff --git a/boca-1.5.2/src/libchart/classes/Axis.php b/boca-1.5.2/src/libchart/classes/Axis.php
deleted file mode 100644
index c80fe97..0000000
--- a/boca-1.5.2/src/libchart/classes/Axis.php
+++ /dev/null
@@ -1,167 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Automatic axis boundaries and ticks calibration
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class Axis
- {
- /**
- * Creates a new axis formatter
- *
- * @access public
- * @param integer minimum value on the axis
- * @param integer maximum value on the axis
- */
-
- function Axis($min, $max)
- {
- $this->min = $min;
- $this->max = $max;
-
- $this->guide = 10;
- }
-
- /**
- * Computes value between two ticks
- *
- * @access private
- */
-
- function quantizeTics()
- {
- // Approximate number of decades, in [1..10[
-
- $norm = $this->delta / $this->magnitude;
-
- // Approximate number of tics per decade
-
- $posns = $this->guide / $norm;
-
- if ($posns > 20)
- $tics = 0.05; // e.g. 0, .05, .10, ...
- else
- if ($posns > 10)
- $tics = 0.2; // e.g. 0, .1, .2, ...
- else
- if ($posns > 5)
- $tics = 0.4; // e.g. 0, 0.2, 0.4, ...
- else
- if ($posns > 3)
- $tics = 0.5; // e.g. 0, 0.5, 1, ...
- else
- if ($posns > 2)
- $tics = 1; // e.g. 0, 1, 2, ...
- else
- if ($posns > 0.25)
- $tics = 2; // e.g. 0, 2, 4, 6
- else
- $tics = ceil($norm);
-
- $this->tics = $tics * $this->magnitude;
- }
-
- /**
- * Computes automatic boundaries on the axis
- *
- * @access public
- */
-
- function computeBoundaries()
- {
- // Range
-
- $this->delta = abs($this->max - $this->min);
-
- // Check for null distribution
-
- if($this->delta == 0)
- $this->delta = 1;
-
- // Order of magnitude of range
-
- $this->magnitude = pow(10, floor(log10($this->delta)));
-
- $this->quantizeTics();
-
- $this->displayMin = floor($this->min / $this->tics) * $this->tics;
- $this->displayMax = ceil($this->max / $this->tics) * $this->tics;
- $this->displayDelta = $this->displayMax - $this->displayMin;
-
- // Check for null distribution
-
- if($this->displayDelta == 0)
- $this->displayDelta = 1;
- }
-
- /**
- * Set boundaries on the axis. Theses values override the automatic values.
- *
- * @access public
- */
-
- function setBoundaries($sampleCount, $yMinValue, $yMaxValue)
- {
- $this->sampleCount = $sampleCount;
- $this->yMinValue = $yMinValue;
- $this->yMaxValue = $yMaxValue;
- }
-
- /**
- * Get the lower boundary on the axis
- *
- * @access public
- * @return integer lower boundary on the axis
- */
-
- function getLowerBoundary()
- {
- return $this->displayMin;
- }
-
- /**
- * Get the upper boundary on the axis
- *
- * @access public
- * @return integer upper boundary on the axis
- */
-
- function getUpperBoundary()
- {
- return $this->displayMax;
- }
-
- /**
- * Get the value between two ticks
- *
- * @access public
- * @return integer value between two ticks
- */
-
- function getTics()
- {
- return $this->tics;
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/BarChart.php b/boca-1.5.2/src/libchart/classes/BarChart.php
deleted file mode 100644
index 5b658ca..0000000
--- a/boca-1.5.2/src/libchart/classes/BarChart.php
+++ /dev/null
@@ -1,172 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Base bar chart class (horizontal or vertical)
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- * @abstract
- */
-
- class BarChart extends Chart
- {
- /**
- * Creates a new bar chart
- *
- * @access protected
- * @param integer width of the image
- * @param integer height of the image
- */
-
- function BarChart($width, $height)
- {
- parent::Chart($width, $height);
-
- $this->setMargin(5);
- $this->setLowerBound(0);
- }
-
- /**
- * Compute the boundaries on the axis
- *
- * @access protected
- */
-
- function computeBound()
- {
- // Compute lower and upper bound on the value axis
-
- $point = current($this->point);
-
- // Check if some points were defined
-
- if(!$point)
- {
- $yMin = 0;
- $yMax = 1;
- }
- else
- {
- $yMax = $yMin = $point->getY();
-
- foreach($this->point as $point)
- {
- $y = $point->getY();
-
- if($y < $yMin)
- $yMin = $y;
-
- if($y > $yMax)
- $yMax = $y;
- }
- }
-
- $this->yMinValue = isset($this->lowerBound) ? $this->lowerBound : $yMin;
- $this->yMaxValue = isset($this->upperBound) ? $this->upperBound : $yMax;
-
- // Compute boundaries on the sample axis
-
- $this->sampleCount = count($this->point);
- }
-
- /**
- * Set manually the lower boundary value (overrides the automatic formatting)
- * Typical usage is to set the bars starting from zero
- *
- * @access public
- * @param double lower boundary value
- */
-
- function setLowerBound($lowerBound)
- {
- $this->lowerBound = $lowerBound;
- }
-
- /**
- * Set manually the upper boundary value (overrides the automatic formatting)
- *
- * @access public
- * @param double upper boundary value
- */
-
- function setUpperBound($upperBound)
- {
- $this->upperBound = $upperBound;
- }
-
- /**
- * Compute the image layout
- *
- * @access protected
- */
-
- function computeLabelMargin()
- {
- $this->axis = new Axis($this->yMinValue, $this->yMaxValue);
- $this->axis->computeBoundaries();
-
- $this->graphTLX = $this->margin + $this->labelMarginLeft;
- $this->graphTLY = $this->margin + $this->labelMarginTop;
- $this->graphBRX = $this->width - $this->margin - $this->labelMarginRight;
- $this->graphBRY = $this->height - $this->margin - $this->labelMarginBottom;
- }
-
- /**
- * Create the image
- *
- * @access protected
- */
-
- function createImage()
- {
- parent::createImage();
-
- $this->axisColor1 = new Color(201, 201, 201);
- $this->axisColor2 = new Color(158, 158, 158);
-
- $this->aquaColor1 = new Color(242, 242, 242);
- $this->aquaColor2 = new Color(231, 231, 231);
- $this->aquaColor3 = new Color(239, 239, 239);
- $this->aquaColor4 = new Color(253, 253, 253);
-
- $this->barColor1 = new Color(42, 71, 181);
- $this->barColor2 = new Color(33, 56, 143);
-
- $this->barColor3 = new Color(172, 172, 210);
- $this->barColor4 = new Color(117, 117, 143);
-
- // Aqua-like background
-
- $aquaColor = Array($this->aquaColor1, $this->aquaColor2, $this->aquaColor3, $this->aquaColor4);
-
- for($i = $this->graphTLY; $i < $this->graphBRY; $i++)
- {
- $color = $aquaColor[($i + 3) % 4];
- $this->primitive->line($this->graphTLX, $i, $this->graphBRX, $i, $color);
- }
-
- // Axis
-
- imagerectangle($this->img, $this->graphTLX - 1, $this->graphTLY, $this->graphTLX, $this->graphBRY, $this->axisColor1->getColor($this->img));
- imagerectangle($this->img, $this->graphTLX - 1, $this->graphBRY, $this->graphBRX, $this->graphBRY + 1, $this->axisColor1->getColor($this->img));
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/Chart.php b/boca-1.5.2/src/libchart/classes/Chart.php
deleted file mode 100644
index 639eabd..0000000
--- a/boca-1.5.2/src/libchart/classes/Chart.php
+++ /dev/null
@@ -1,213 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /*! \mainpage Libchart
- *
- * This is the reference API, automatically compiled by <a href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</a>.
- * You can find here information that is not covered by the <a href="../samplecode/">tutorial</a>.
- *
- */
-
- /**
- * Base chart class
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- * @abstract
- */
-
- class Chart
- {
- /**
- * Creates a new chart
- *
- * @access protected
- * @param integer width of the image
- * @param integer height of the image
- */
-
- function chart($width, $height)
- {
- $this->width = $width;
- $this->height = $height;
-
- $this->reset();
- }
-
- /**
- * Initialize the chart
- *
- * @access private
- */
-
- function reset()
- {
- $this->text = new Text();
- $this->point = array();
-
- unset($this->lowerBound);
- unset($this->upperBound);
-
- $this->setTitle("Untitled chart");
- $this->setLogo(dirname(__FILE__) . "/../images/PoweredBy.png");
- }
-
- /**
- * Add a new sampling point to the chart
- *
- * @access public
- * @param Point sampling point to add
- */
-
- function addPoint($point)
- {
- array_push($this->point, $point);
- }
-
- /**
- * Sets the title
- *
- * @access public
- * @param string new title
- */
-
- function setTitle($title)
- {
- $this->title = $title;
- }
-
- /**
- * Sets the logo image file name
- *
- * @access public
- * @param string new logo image file name
- */
-
- function setLogo($logoFileName)
- {
- $this->logoFileName = $logoFileName;
- }
-
- /**
- * Print the title to the image
- *
- * @access private
- */
-
- function printTitle()
- {
- $this->text->printCentered($this->img, ($this->labelMarginTop + $this->margin) / 2, $this->textColor, $this->title, $this->text->fontCondensedBold);
- }
-
- /**
- * Print the logo image to the image
- *
- * @access private
- */
-
- function printLogo()
- {
- @$logoImage = imageCreateFromPNG($this->logoFileName);
-
- if($logoImage)
- imagecopymerge($this->img, $logoImage, 2*$this->margin, $this->margin, 0, 0, imagesx($logoImage), imagesy($logoImage), 100);
- }
-
- /**
- * Set the outer margin
- *
- * @access public
- * @param integer outer margin value in pixels
- */
-
- function setMargin($margin)
- {
- $this->margin = $margin;
- }
-
- /**
- * Set the label left margin
- *
- * @access public
- * @param integer label left margin value in pixels
- */
-
- function setLabelMarginLeft($labelMarginLeft)
- {
- $this->labelMarginLeft = $labelMarginLeft;
- }
-
- /**
- * Set the label right margin
- *
- * @access public
- * @param integer label right margin value in pixels
- */
-
- function setLabelMarginRight($labelMarginRight)
- {
- $this->labelMarginRight = $labelMarginRight;
- }
-
- /**
- * Set the label top margin
- *
- * @access public
- * @param integer label top margin value in pixels
- */
-
- function setLabelMarginTop($labelMarginTop)
- {
- $this->labelMarginTop = $labelMarginTop;
- }
-
- /**
- * Set the label bottom margin
- *
- * @access public
- * @param integer label bottom margin value in pixels
- */
-
- function setLabelMarginBottom($labelMarginBottom)
- {
- $this->labelMarginBottom = $labelMarginBottom;
- }
-
- /**
- * Creates and initialize the image
- *
- * @access protected
- */
-
- function createImage()
- {
- $this->img = imagecreatetruecolor($this->width, $this->height);
-
- $this->primitive = new Primitive($this->img);
-
- $this->backGroundColor = new Color(255, 255, 255);
- $this->textColor = new Color(0, 0, 0);
-
- // White background
-
- imagefilledrectangle($this->img, 0, 0, $this->width - 1, $this->height - 1, $this->backGroundColor->getColor($this->img));
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/Color.php b/boca-1.5.2/src/libchart/classes/Color.php
deleted file mode 100644
index 178435b..0000000
--- a/boca-1.5.2/src/libchart/classes/Color.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Color
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class Color
- {
- /**
- * Creates a new color
- *
- * @access public
- * @param integer red [0,255]
- * @param integer green [0,255]
- * @param integer blue [0,255]
- * @param integer alpha [0,255]
- */
-
- function Color($red, $green, $blue, $alpha = 0)
- {
- $this->red = (int)$red;
- $this->green = (int)$green;
- $this->blue = (int)$blue;
- $this->alpha = (int)round($alpha * 127.0 / 255);
-
- $this->gdColor = null;
- }
-
- /**
- * Get GD color
- *
- * @access public
- * @param $img GD image resource
- */
-
- function getColor($img)
- {
- // Checks if color has already been allocated
-
- if(!$this->gdColor)
- {
- if($this->alpha == 0 || !function_exists('imagecolorallocatealpha'))
- $this->gdColor = imagecolorallocate($img, $this->red, $this->green, $this->blue);
- else
- $this->gdColor = imagecolorallocatealpha($img, $this->red, $this->green, $this->blue, $this->alpha);
- }
-
- // Returns GD color
-
- return $this->gdColor;
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/HorizontalChart.php b/boca-1.5.2/src/libchart/classes/HorizontalChart.php
deleted file mode 100644
index 4b4e069..0000000
--- a/boca-1.5.2/src/libchart/classes/HorizontalChart.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Horizontal bar chart
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class HorizontalChart extends BarChart
- {
- /**
- * Creates a new horizontal bar chart
- *
- * @access public
- * @param integer width of the image
- * @param integer height of the image
- */
-
- function HorizontalChart($width = 600, $height = 250)
- {
- parent::BarChart($width, $height);
-
- $this->setLabelMarginLeft(150);
- $this->setLabelMarginRight(30);
- $this->setLabelMarginTop(40);
- $this->setLabelMarginBottom(30);
- }
-
- /**
- * Print the axis
- *
- * @access private
- */
-
- function printAxis()
- {
- // Check if some points were defined
-
- if(!$this->sampleCount)
- return;
-
- $minValue = $this->axis->getLowerBoundary();
- $maxValue = $this->axis->getUpperBoundary();
- $stepValue = $this->axis->getTics();
-
- // Horizontal axis
-
- for($value = $minValue; $value <= $maxValue; $value += $stepValue)
- {
- $x = $this->graphTLX + ($value - $minValue) * ($this->graphBRX - $this->graphTLX) / ($this->axis->displayDelta);
-
- imagerectangle($this->img, $x - 1, $this->graphBRY + 2, $x, $this->graphBRY + 3, $this->axisColor1->getColor($this->img));
- imagerectangle($this->img, $x - 1, $this->graphBRY, $x, $this->graphBRY + 1, $this->axisColor2->getColor($this->img));
-
- $this->text->printText($this->img, $x, $this->graphBRY + 5, $this->textColor, $value, $this->text->fontCondensed, $this->text->HORIZONTAL_CENTER_ALIGN);
- }
-
- // Vertical Axis
-
- $rowHeight = ($this->graphBRY - $this->graphTLY) / $this->sampleCount;
-
- reset($this->point);
-
- for($i = 0; $i <= $this->sampleCount; $i++)
- {
- $y = $this->graphBRY - $i * $rowHeight;
-
- imagerectangle($this->img, $this->graphTLX - 3, $y, $this->graphTLX - 2, $y + 1, $this->axisColor1->getColor($this->img));
- imagerectangle($this->img, $this->graphTLX - 1, $y, $this->graphTLX, $y + 1, $this->axisColor2->getColor($this->img));
-
- if($i < $this->sampleCount)
- {
- $point = current($this->point);
- next($this->point);
-
- $text = $point->getX();
-
- $this->text->printText($this->img, $this->graphTLX - 5, $y - $rowHeight / 2, $this->textColor, $text, $this->text->fontCondensed, $this->text->HORIZONTAL_RIGHT_ALIGN | $this->text->VERTICAL_CENTER_ALIGN);
- }
- }
- }
-
- /**
- * Print the bars
- *
- * @access private
- */
-
- function printBar()
- {
- // Check if some points were defined
-
- if(!$this->sampleCount)
- return;
-
- reset($this->point);
-
- $minValue = $this->axis->getLowerBoundary();
- $maxValue = $this->axis->getUpperBoundary();
- $stepValue = $this->axis->getTics();
-
- $rowHeight = ($this->graphBRY - $this->graphTLY) / $this->sampleCount;
-
- for($i = 0; $i < $this->sampleCount; $i++)
- {
- $y = $this->graphBRY - $i * $rowHeight;
-
- $point = current($this->point);
- next($this->point);
-
- $value = $point->getY();
-
- $xmax = $this->graphTLX + ($value - $minValue) * ($this->graphBRX - $this->graphTLX) / ($this->axis->displayDelta);
-
- $this->text->printText($this->img, $xmax + 5, $y - $rowHeight / 2, $this->textColor, $value, $this->text->fontCondensed, $this->text->VERTICAL_CENTER_ALIGN);
-
- // Horizontal bar
-
- $y1 = $y - $rowHeight * 4 / 5;
- $y2 = $y - $rowHeight * 1 / 5;
-
- imagefilledrectangle($this->img, $this->graphTLX + 1, $y1, $xmax, $y2, $this->barColor2->getColor($this->img));
- imagefilledrectangle($this->img, $this->graphTLX + 2, $y1+1, $xmax - 4, $y2, $this->barColor1->getColor($this->img));
- }
- }
-
- /**
- * Render the chart image
- *
- * @access public
- * @param string name of the file to render the image to (optional)
- */
-
- function render($fileName = null)
- {
- $this->computeBound();
- $this->computeLabelMargin();
- $this->createImage();
- $this->printLogo();
- $this->printTitle();
- $this->printAxis();
- $this->printBar();
-
- if(isset($fileName))
- imagepng($this->img, $fileName);
- else
- imagepng($this->img);
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/LineChart.php b/boca-1.5.2/src/libchart/classes/LineChart.php
deleted file mode 100644
index 9d44eba..0000000
--- a/boca-1.5.2/src/libchart/classes/LineChart.php
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Line chart
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class LineChart extends BarChart
- {
- /**
- * Creates a new line chart
- *
- * @access public
- * @param integer width of the image
- * @param integer height of the image
- */
-
- function LineChart($width = 600, $height = 250)
- {
- parent::BarChart($width, $height);
-
- $this->setLabelMarginLeft(50);
- $this->setLabelMarginRight(50);
- $this->setLabelMarginTop(40);
- $this->setLabelMarginBottom(50);
- }
-
- /**
- * Print the axis
- *
- * @access private
- */
-
- function printAxis()
- {
- // Check if some points were defined
-
- if($this->sampleCount < 2)
- return;
-
- $minValue = $this->axis->getLowerBoundary();
- $maxValue = $this->axis->getUpperBoundary();
- $stepValue = $this->axis->getTics();
-
- // Line axis
-
- for($value = $minValue; $value <= $maxValue; $value += $stepValue)
- {
- $y = $this->graphBRY - ($value - $minValue) * ($this->graphBRY - $this->graphTLY) / ($this->axis->displayDelta);
-
- imagerectangle($this->img, $this->graphTLX - 3, $y, $this->graphTLX - 2, $y + 1, $this->axisColor1->getColor($this->img));
- imagerectangle($this->img, $this->graphTLX - 1, $y, $this->graphTLX, $y + 1, $this->axisColor2->getColor($this->img));
-
- $this->text->printText($this->img, $this->graphTLX - 5, $y, $this->textColor, $value, $this->text->fontCondensed, $this->text->HORIZONTAL_RIGHT_ALIGN | $this->text->VERTICAL_CENTER_ALIGN);
- }
-
- // Horizontal Axis
-
- $columnWidth = ($this->graphBRX - $this->graphTLX) / ($this->sampleCount - 1);
-
- reset($this->point);
-
- for($i = 0; $i < $this->sampleCount; $i++)
- {
- $x = $this->graphTLX + $i * $columnWidth;
-
- imagerectangle($this->img, $x - 1, $this->graphBRY + 2, $x, $this->graphBRY + 3, $this->axisColor1->getColor($this->img));
- imagerectangle($this->img, $x - 1, $this->graphBRY, $x, $this->graphBRY + 1, $this->axisColor2->getColor($this->img));
-
- $point = current($this->point);
- next($this->point);
-
- $text = $point->getX();
-
- $this->text->printDiagonal($this->img, $x - 5, $this->graphBRY + 10, $this->textColor, $text);
- }
- }
-
- /**
- * Print the lines
- *
- * @access private
- */
-
- function printLine()
- {
- // Check if some points were defined
-
- if($this->sampleCount < 2)
- return;
-
- reset($this->point);
-
- $minValue = $this->axis->getLowerBoundary();
- $maxValue = $this->axis->getUpperBoundary();
-
- $columnWidth = ($this->graphBRX - $this->graphTLX) / ($this->sampleCount - 1);
-
- $x1 = null;
- $y1 = null;
-
- for($i = 0; $i < $this->sampleCount; $i++)
- {
- $x2 = $this->graphTLX + $i * $columnWidth;
-
- $point = current($this->point);
- next($this->point);
-
- $value = $point->getY();
-
- $y2 = $this->graphBRY - ($value - $minValue) * ($this->graphBRY - $this->graphTLY) / ($this->axis->displayDelta);
-
-// $this->text->printText($this->img, $x2, $y2 - 5, $this->textColor, $value, $this->text->fontCondensed, $this->text->HORIZONTAL_CENTER_ALIGN | $this->text->VERTICAL_BOTTOM_ALIGN);
-
- // Draw line
-
- if($x1)
- {
- $this->primitive->line($x1, $y1, $x2, $y2, $this->barColor4, 4);
- $this->primitive->line($x1, $y1 - 1, $x2, $y2 - 1, $this->barColor3, 2);
- }
-
- $x1 = $x2;
- $y1 = $y2;
- }
- }
-
- /**
- * Render the chart image
- *
- * @access public
- * @param string name of the file to render the image to (optional)
- */
-
- function render($fileName = null)
- {
- $this->computeBound();
- $this->computeLabelMargin();
- $this->createImage();
- $this->printLogo();
- $this->printTitle();
- $this->printAxis();
- $this->printLine();
-
- if(isset($fileName))
- imagepng($this->img, $fileName);
- else
- imagepng($this->img);
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/PieChart.php b/boca-1.5.2/src/libchart/classes/PieChart.php
deleted file mode 100644
index dacbf2b..0000000
--- a/boca-1.5.2/src/libchart/classes/PieChart.php
+++ /dev/null
@@ -1,386 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Pie chart
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class PieChart extends Chart
- {
- /**
- * Creates a new pie chart
- *
- * @access public
- * @param integer width of the image
- * @param integer height of the image
- */
-
- function PieChart($width = 600, $height = 250)
- {
- parent::Chart($width, $height);
-
- $this->setMargin(5);
- $this->setLabelMarginLeft(30);
- $this->setLabelMarginRight(30);
- $this->setLabelMarginTop(50);
- $this->setLabelMarginBottom(30);
- $this->setLabelMarginCenter(20);
-
- $this->setPieRatio(0.55);
-
- $this->labelBoxWidth = 15;
- $this->labelBoxHeight = 15;
- }
-
- /**
- * Set the ratio of the pie image over the legend
- *
- * @access public
- * @param double ratio (value between 0 and 1)
- */
-
- function setPieRatio($pieRatio)
- {
- $this->pieRatio = $pieRatio;
- }
-
- /**
- * Compare two sampling point values, order from biggest to lowest value
- *
- * @access private
- * @param double first value
- * @param double second value
- * @return integer result of the comparison
- */
-
- function sortPie($v1, $v2)
- {
- return $v1[0] == $v2[0] ? 0 :
- $v1[0] > $v2[0] ? -1 :
- 1;
- }
-
- /**
- * Compute pie values in percentage and sort them
- *
- * @access private
- */
-
- function computePercent()
- {
- $this->total = 0;
- $this->percent = array();
-
- foreach($this->point as $point)
- $this->total += $point->getY();
-
- foreach($this->point as $point)
- {
- $percent = $this->total == 0 ? 0 : 100 * $point->getY() / $this->total;
-
- array_push($this->percent, array($percent, $point));
- }
- if($this->order)
- usort($this->percent, array("PieChart", "sortPie"));
- }
-
- /**
- * Set the margin between the pie image and the legend
- *
- * @access public
- * @param integer margin value in pixels
- */
-
- function setLabelMarginCenter($labelMarginCenter)
- {
- $this->labelMarginCenter = $labelMarginCenter;
- }
-
- /**
- * Draw a gray box with nice borders
- *
- * @access private
- * @param integer top left coordinate (x)
- * @param integer top left coordinate (y)
- * @param integer bottom right coordinate (x)
- * @param integer bottom right coordinate (y)
- */
-
- function outlinedBox($x1, $y1, $x2, $y2)
- {
- imagefilledrectangle($this->img, $x1, $y1, $x2, $y2, $this->axisColor1->getColor($this->img));
- imagerectangle($this->img, $x1, $y1, $x1 + 1, $y1 + 1, $this->axisColor2->getColor($this->img));
- imagerectangle($this->img, $x2 - 1, $y1, $x2, $y1 + 1, $this->axisColor2->getColor($this->img));
- imagerectangle($this->img, $x1, $y2 - 1, $x1 + 1, $y2, $this->axisColor2->getColor($this->img));
- imagerectangle($this->img, $x2 - 1, $y2 - 1, $x2, $y2, $this->axisColor2->getColor($this->img));
- }
-
- /**
- * Compute image layout
- *
- * @access private
- */
-
- function computeLabelMargin()
- {
- $graphWidth = $this->width - $this->margin * 2 - $this->labelMarginLeft - $this->labelMarginCenter - $this->labelMarginRight;
-
- $this->pieTLX = $this->margin + $this->labelMarginLeft;
- $this->pieTLY = $this->margin + $this->labelMarginTop;
- $this->pieBRX = $this->pieTLX + $graphWidth * $this->pieRatio;
- $this->pieBRY = $this->height - $this->margin - $this->labelMarginBottom;
-
- $this->pieCenterX = $this->pieTLX + ($this->pieBRX - $this->pieTLX) / 2;
- $this->pieCenterY = $this->pieTLY + ($this->pieBRY - $this->pieTLY) / 2;
-
- $this->pieWidth = round(($this->pieBRX - $this->pieTLX) * 4 / 5);
- $this->pieHeight = round(($this->pieBRY - $this->pieTLY) * 3.7 / 5);
- $this->pieDepth = round($this->pieWidth * 0.05);
-
- $this->labelTLX = $this->pieBRX + $this->labelMarginCenter;
- $this->labelTLY = $this->pieTLY;
- $this->labelBRX = $this->pieTLX + $this->labelMarginCenter + $graphWidth;
- $this->labelBRY = $this->pieBRY;
-
- }
-
- /**
- * Creates the pie chart image
- *
- * @access private
- */
-
- function createImage()
- {
- parent::createImage();
-
- $pieColors = array(
- array(2, 78, 0),
- array(148, 170, 36),
- array(233, 191, 49),
- array(240, 127, 41),
- array(243, 63, 34),
- array(190, 71, 47),
- array(135, 81, 60),
- array(128, 78, 162),
- array(121, 75, 255),
- array(142, 165, 250),
- array(162, 254, 239),
- array(137, 240, 166),
- array(104, 221, 71),
- array(98, 174, 35),
- array(93, 129, 1)
- );
-
- $this->pieColor = array();
- $this->pieShadowColor = array();
- $shadowFactor = 0.5;
-
- foreach($pieColors as $colorRGB)
- {
- list($red, $green, $blue) = $colorRGB;
-
- $color = new Color($red, $green, $blue);
- $shadowColor = new Color($red * $shadowFactor,
- $green * $shadowFactor,
- $blue * $shadowFactor);
-
- array_push($this->pieColor, $color);
- array_push($this->pieShadowColor, $shadowColor);
- }
-
- $this->axisColor1 = new Color(201, 201, 201);
- $this->axisColor2 = new Color(158, 158, 158);
-
- $this->aquaColor1 = new Color(242, 242, 242);
- $this->aquaColor2 = new Color(231, 231, 231);
- $this->aquaColor3 = new Color(239, 239, 239);
- $this->aquaColor4 = new Color(253, 253, 253);
-
- // Legend box
-
- $this->outlinedBox($this->pieTLX, $this->pieTLY, $this->pieBRX, $this->pieBRY);
-
- // Aqua-like background
-
- $aquaColor = Array($this->aquaColor1, $this->aquaColor2, $this->aquaColor3, $this->aquaColor4);
-
- for($i = $this->pieTLY + 2; $i < $this->pieBRY - 1; $i++)
- {
- $color = $aquaColor[($i + 3) % 4];
- $this->primitive->line($this->pieTLX + 2, $i, $this->pieBRX - 2, $i, $color);
- }
- }
-
- /**
- * Print legend
- *
- * @access private
- */
-
- function printLabel()
- {
- $i = 0;
-
- $boxX1 = $this->labelTLX + $this->margin;
- $boxX2 = $boxX1 + $this->labelBoxWidth;
-
- foreach($this->percent as $a)
- {
- list($percent, $point) = $a;
- $legend = $point->getX();
-
- if($point->getColor() != null)
- $color = $point->getColor();
- else
- $color = $this->pieColor[$i % count($this->pieColor)];
-
- $boxY1 = $this->labelTLY + $this->margin + $i * ($this->labelBoxHeight + $this->margin);
- $boxY2 = $boxY1 + $this->labelBoxHeight;
-
- $this->outlinedBox($boxX1, $boxY1, $boxX2, $boxY2);
- imagefilledrectangle($this->img, $boxX1 + 2, $boxY1 + 2, $boxX2 - 2, $boxY2 - 2, $color->getColor($this->img));
-
- $this->text->printText($this->img, $boxX2 + $this->margin, $boxY1 + $this->labelBoxHeight / 2, $this->textColor, $legend, $this->text->fontCondensed, $this->text->VERTICAL_CENTER_ALIGN);
-
- $i++;
- }
- }
-
- /**
- * Draw a 2D disc
- *
- * @access private
- * @param integer center coordinate (y)
- * @param array colors for each portion
- * @param bitfield drawing mode
- */
-
- function drawDisc($cy, $colorArray, $mode, $shad=false)
- {
- $i = 0;
- $angle1 = 0;
- $percentTotal = 0;
-
- foreach($this->percent as $a)
- {
- list($percent, $point) = $a;
-
- if($point->getColor() != null)
- $color = $shad ? $point->getShadowColor() : $point->getColor();
- else
- $color = $colorArray[$i % count($colorArray)];
-
- $percentTotal += $percent;
- $angle2 = $percentTotal * 360 / 100;
-
- imagefilledarc($this->img, $this->pieCenterX, $cy, $this->pieWidth, $this->pieHeight, $angle1, $angle2, $color->getColor($this->img), $mode);
-
- $angle1 = $angle2;
-
- $i++;
- }
- }
-
- /**
- * Print the percentage text
- *
- * @access private
- */
-
- function drawPercent()
- {
- $angle1 = 0;
- $percentTotal = 0;
-
- foreach($this->percent as $a)
- {
- list($percent, $point) = $a;
-
- // If value is null, don't print percentage
-
- if($percent <= 0)
- continue;
-
- $percentTotal += $percent;
- $angle2 = $percentTotal * 2 * M_PI / 100;
-
- $angle = $angle1 + ($angle2 - $angle1) / 2;
- $text = number_format($percent) . "%";
-
- $x = cos($angle) * ($this->pieWidth + 35) / 2 + $this->pieCenterX;
- $y = sin($angle) * ($this->pieHeight + 35) / 2 + $this->pieCenterY;
-
- $this->text->printText($this->img, $x, $y, $this->textColor, $text, $this->text->fontCondensed, $this->text->HORIZONTAL_CENTER_ALIGN | $this->text->VERTICAL_CENTER_ALIGN);
-
- $angle1 = $angle2;
- }
- }
-
- /**
- * Print the pie chart
- *
- * @access private
- */
-
- function printPie()
- {
- // Silhouette
-
- for ($cy = $this->pieCenterY + $this->pieDepth / 2; $cy >= $this->pieCenterY - $this->pieDepth / 2; $cy--)
- $this->drawDisc($cy, $this->pieShadowColor, IMG_ARC_EDGED, true);
-
-
- // Top
-
- $this->drawDisc($this->pieCenterY - $this->pieDepth / 2, $this->pieColor, IMG_ARC_PIE);
-
- // Top Outline
-
- $this->drawPercent();
- }
-
- /**
- * Render the chart image
- *
- * @access public
- * @param string name of the file to render the image to (optional)
- */
-
- function render($fileName = null)
- {
- $this->computeLabelMargin();
- $this->computePercent();
- $this->createImage();
- $this->printLogo();
- $this->printTitle();
- $this->printPie();
- $this->printLabel();
-
- if(isset($fileName))
- imagepng($this->img, $fileName);
- else
- imagepng($this->img);
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/Point.php b/boca-1.5.2/src/libchart/classes/Point.php
deleted file mode 100644
index 5c0d9ec..0000000
--- a/boca-1.5.2/src/libchart/classes/Point.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Sampling point
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class Point
- {
- /**
- * Creates a new sampling point of coordinates (x, y)
- *
- * @access public
- * @param integer x coordinate (label)
- * @param integer y coordinate (value)
- * @param array color R,G,B
- */
-
- function Point($x, $y, $c=null)
- {
- $this->x = $x;
- $this->y = $y;
- if($c != null) {
- list($r,$g,$b) = $c;
- $this->color = new Color($r,$g,$b);
- $shadowFactor = 0.5;
- $this->shadowColor = new Color($r * $shadowFactor,
- $g * $shadowFactor,
- $b * $shadowFactor);
- } else {
- $this->color = null;
- $this->shadowColor = null;
- }
- }
-
- /**
- * Gets the x coordinate (label)
- *
- * @access public
- * @return integer x coordinate (label)
- */
-
- function getX()
- {
- return $this->x;
- }
-
- /**
- * Gets the y coordinate (value)
- *
- * @access public
- * @return integer y coordinate (value)
- */
-
- function getY()
- {
- return $this->y;
- }
-
- function getColor() { return $this->color; }
- function getShadowColor() { return $this->shadowColor; }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/Primitive.php b/boca-1.5.2/src/libchart/classes/Primitive.php
deleted file mode 100644
index 9e5a896..0000000
--- a/boca-1.5.2/src/libchart/classes/Primitive.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Graphic primitives, extends GD with chart related primitives
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class Primitive
- {
- /**
- * Creates a new primitive object
- *
- * @access public
- * @param resource GD image resource
- */
-
- function Primitive($img)
- {
- $this->img = $img;
- }
-
- /**
- * Draws a straight line
- *
- * @access public
- * @param integer line start (X)
- * @param integer line start (Y)
- * @param integer line end (X)
- * @param integer line end (Y)
- * @param Color line color
- */
-
- function line($x1, $y1, $x2, $y2, $color, $width = 1)
- {
- imagefilledpolygon($this->img, array($x1, $y1 - $width / 2, $x1, $y1 + $width / 2, $x2, $y2 + $width / 2, $x2, $y2 - $width / 2), 4, $color->getColor($this->img));
-// imageline($this->img, $x1, $y1, $x2, $y2, $color->getColor($this->img));
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/Text.php b/boca-1.5.2/src/libchart/classes/Text.php
deleted file mode 100644
index 7f7177c..0000000
--- a/boca-1.5.2/src/libchart/classes/Text.php
+++ /dev/null
@@ -1,139 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Text drawing helper
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class Text
- {
- var $HORIZONTAL_LEFT_ALIGN = 1; // PHP4 doesn't support class constants
- var $HORIZONTAL_CENTER_ALIGN = 2;
- var $HORIZONTAL_RIGHT_ALIGN = 4;
- var $VERTICAL_TOP_ALIGN = 8;
- var $VERTICAL_CENTER_ALIGN = 16;
- var $VERTICAL_BOTTOM_ALIGN = 32;
-
- /**
- * Creates a new text drawing helper
- *
- * @access public
- */
-
- function Text()
- {
- // Free low-res fonts based on Bitstream Vera <http://dejavu.sourceforge.net/wiki/>
-
- $this->fontCondensed = dirname(__FILE__) . "/../fonts/DejaVuSansCondensed.ttf";
- $this->fontCondensedBold = dirname(__FILE__) . "/../fonts/DejaVuSansCondensed-Bold.ttf";
- }
-
- /**
- * Print text
- *
- * @access public
- * @param Image GD image
- * @param integer text coordinate (x)
- * @param integer text coordinate (y)
- * @param Color text color
- * @param string text value
- * @param string font file name
- * @param bitfield text alignment
- */
-
- function printText($img, $px, $py, $color, $text, $fontFileName, $align = 0)
- {
- if(!($align & $this->HORIZONTAL_CENTER_ALIGN) && !($align & $this->HORIZONTAL_RIGHT_ALIGN))
- $align |= $this->HORIZONTAL_LEFT_ALIGN;
-
- if(!($align & $this->VERTICAL_CENTER_ALIGN) && !($align & $this->VERTICAL_BOTTOM_ALIGN))
- $align |= $this->VERTICAL_TOP_ALIGN;
-
- $fontSize = 8;
- $lineSpacing = 1;
-
- list($llx, $lly, $lrx, $lry, $urx, $ury, $ulx, $uly) = imageftbbox($fontSize, 0, $fontFileName, $text, array("linespacing" => $lineSpacing));
-
- $textWidth = $lrx - $llx;
- $textHeight = $lry - $ury;
-
- $angle = 0;
-
- if($align & $this->HORIZONTAL_CENTER_ALIGN)
- $px -= $textWidth / 2;
-
- if($align & $this->HORIZONTAL_RIGHT_ALIGN)
- $px -= $textWidth;
-
- if($align & $this->VERTICAL_CENTER_ALIGN)
- $py += $textHeight / 2;
-
- if($align & $this->VERTICAL_TOP_ALIGN)
- $py += $textHeight;
-
- imagettftext($img, $fontSize, $angle, $px, $py, $color->getColor($img), $fontFileName, $text);
- }
-
- /**
- * Print text centered horizontally on the image
- *
- * @access public
- * @param Image GD image
- * @param integer text coordinate (y)
- * @param Color text color
- * @param string text value
- * @param string font file name
- */
-
- function printCentered($img, $py, $color, $text, $fontFileName)
- {
- $this->printText($img, imagesx($img) / 2, $py, $color, $text, $fontFileName, $this->HORIZONTAL_CENTER_ALIGN | $this->VERTICAL_CENTER_ALIGN);
- }
-
- /**
- * Print text in diagonal
- *
- * @access public
- * @param Image GD image
- * @param integer text coordinate (x)
- * @param integer text coordinate (y)
- * @param Color text color
- * @param string text value
- */
-
- function printDiagonal($img, $px, $py, $color, $text)
- {
- $fontSize = 8;
- $fontFileName = $this->fontCondensed;
-
- $lineSpacing = 1;
-
- list($lx, $ly, $rx, $ry) = imageftbbox($fontSize, 0, $fontFileName, $text, array("linespacing" => $lineSpacing));
- $textWidth = $rx - $lx;
-
- $angle = -45;
-
- imagettftext($img, $fontSize, $angle, $px, $py, $color->getColor($img), $fontFileName, $text);
- }
- }
-?>
diff --git a/boca-1.5.2/src/libchart/classes/VerticalChart.php b/boca-1.5.2/src/libchart/classes/VerticalChart.php
deleted file mode 100644
index cdb4117..0000000
--- a/boca-1.5.2/src/libchart/classes/VerticalChart.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
- /** Libchart - PHP chart library
- *
- * Copyright (C) 2005-2006 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- */
-
- /**
- * Vertical bar chart
- *
- * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
- */
-
- class VerticalChart extends BarChart
- {
- /**
- * Creates a new vertical bar chart
- *
- * @access public
- * @param integer width of the image
- * @param integer height of the image
- */
-
- function VerticalChart($width = 600, $height = 250)
- {
- parent::BarChart($width, $height);
-
- $this->setLabelMarginLeft(50);
- $this->setLabelMarginRight(30);
- $this->setLabelMarginTop(40);
- $this->setLabelMarginBottom(50);
- }
-
- /**
- * Print the axis
- *
- * @access private
- */
-
- function printAxis()
- {
- // Check if some points were defined
-
- if(!$this->sampleCount)
- return;
-
- $minValue = $this->axis->getLowerBoundary();
- $maxValue = $this->axis->getUpperBoundary();
- $stepValue = $this->axis->getTics();
-
- // Vertical axis
-
- for($value = $minValue; $value <= $maxValue; $value += $stepValue)
- {
- $y = $this->graphBRY - ($value - $minValue) * ($this->graphBRY - $this->graphTLY) / ($this->axis->displayDelta);
-
- imagerectangle($this->img, $this->graphTLX - 3, $y, $this->graphTLX - 2, $y + 1, $this->axisColor1->getColor($this->img));
- imagerectangle($this->img, $this->graphTLX - 1, $y, $this->graphTLX, $y + 1, $this->axisColor2->getColor($this->img));
-
- $this->text->printText($this->img, $this->graphTLX - 5, $y, $this->textColor, $value, $this->text->fontCondensed, $this->text->HORIZONTAL_RIGHT_ALIGN | $this->text->VERTICAL_CENTER_ALIGN);
- }
-
- // Horizontal Axis
-
- $columnWidth = ($this->graphBRX - $this->graphTLX) / $this->sampleCount;
-
- reset($this->point);
-
- for($i = 0; $i <= $this->sampleCount; $i++)
- {
- $x = $this->graphTLX + $i * $columnWidth;
-
- imagerectangle($this->img, $x - 1, $this->graphBRY + 2, $x, $this->graphBRY + 3, $this->axisColor1->getColor($this->img));
- imagerectangle($this->img, $x - 1, $this->graphBRY, $x, $this->graphBRY + 1, $this->axisColor2->getColor($this->img));
-
- if($i < $this->sampleCount)
- {
- $point = current($this->point);
- next($this->point);
-
- $text = $point->getX();
-
- $this->text->printDiagonal($this->img, $x + $columnWidth * 1 / 3, $this->graphBRY + 10, $this->textColor, $text);
- }
- }
- }
-
- /**
- * Print the bars
- *
- * @access private
- */
-
- function printBar()
- {
- // Check if some points were defined
-
- if(!$this->sampleCount)
- return;
-
- reset($this->point);
-
- $minValue = $this->axis->getLowerBoundary();
- $maxValue = $this->axis->getUpperBoundary();
- $stepValue = $this->axis->getTics();
-
- $columnWidth = ($this->graphBRX - $this->graphTLX) / $this->sampleCount;
-
- for($i = 0; $i < $this->sampleCount; $i++)
- {
- $x = $this->graphTLX + $i * ($this->graphBRX - $this->graphTLX) / $this->sampleCount;
-
- $point = current($this->point);
- next($this->point);
-
- $value = $point->getY();
-
- $ymin = $this->graphBRY - ($value - $minValue) * ($this->graphBRY - $this->graphTLY) / ($this->axis->displayDelta);
-
- $this->text->printText($this->img, $x + $columnWidth / 2, $ymin - 5, $this->textColor, $value, $this->text->fontCondensed, $this->text->HORIZONTAL_CENTER_ALIGN | $this->text->VERTICAL_BOTTOM_ALIGN);
-
- // Vertical bar
-
- $x1 = $x + $columnWidth * 1 / 5;
- $x2 = $x + $columnWidth * 4 / 5;
-
- imagefilledrectangle($this->img, $x1, $ymin, $x2, $this->graphBRY - 1, $this->barColor2->getColor($this->img));
- imagefilledrectangle($this->img, $x1 + 1, $ymin + 1, $x2 - 4, $this->graphBRY - 1, $this->barColor1->getColor($this->img));
- }
- }
-
- /**
- * Render the chart image
- *
- * @access public
- * @param string name of the file to render the image to (optional)
- */
-
- function render($fileName = null)
- {
- $this->computeBound();
- $this->computeLabelMargin();
- $this->createImage();
- $this->printLogo();
- $this->printTitle();
- $this->printAxis();
- $this->printBar();
-
- if(isset($fileName))
- imagepng($this->img, $fileName);
- else
- imagepng($this->img);
- }
- }
-?>