* @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version CVS: $Id$ * @link http://pear.php.net/package/Image_Graph * @since File available since Release 0.3.0dev2 */ /** * Include file Image/Graph/Plot/Smoothed/Bezier.php */ require_once 'Image/Graph/Plot/Smoothed/Bezier.php'; /** * Smoothed radar chart. * * @category Images * @package Image_Graph * @subpackage Plot * @author Jesper Veggerby * @copyright Copyright (C) 2003, 2004 Jesper Veggerby Hansen * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 * @version Release: @package_version@ * @link http://pear.php.net/package/Image_Graph * @since Class available since Release 0.3.0dev2 */ class Image_Graph_Plot_Smoothed_Radar extends Image_Graph_Plot_Smoothed_Bezier { /** * Output the plot * * @return bool Was the output 'good' (true) or 'bad' (false). * @access private */ function _done() { $this->_canvas->startGroup(get_class($this) . '_' . $this->_title); $this->_clip(true); if (is_a($this->_parent, 'Image_Graph_Plotarea_Radar')) { $keys = array_keys($this->_dataset); foreach ($keys as $key) { $dataset =& $this->_dataset[$key]; if ($dataset->count() >= 3) { $dataset->_reset(); $p1_ = $dataset->_next(); $p2_ = $dataset->_next(); $p3_ = $dataset->_next(); $plast_ = false; if ($p3_) { while ($p = $dataset->_next()) { $plast_ = $p; } } if ($plast_ === false) { $plast_ = $p3_; } $dataset->_reset(); while ($p1 = $dataset->_next()) { $p0 = $dataset->_nearby(-2); $p2 = $dataset->_nearby(0); $p3 = $dataset->_nearby(1); if ($p0 === false) { $p0 = $plast_; } if ($p2 === false) { $p2 = $p1_; $p3 = $p2_; } elseif ($p3 === false) { $p3 = $p1_; } $cp = $this->_getControlPoints($p1, $p0, $p2, $p3); $this->_canvas->addSpline( array( 'x' => $cp['X'], 'y' => $cp['Y'], 'p1x' => $cp['P1X'], 'p1y' => $cp['P1Y'], 'p2x' => $cp['P2X'], 'p2y' => $cp['P2Y'] ) ); $next2last = $p0; $last = $p1; } $cp = $this->_getControlPoints($p1_, $plast_, $p2_, $p3_); $this->_canvas->addSpline( array( 'x' => $cp['X'], 'y' => $cp['Y'], 'p1x' => $cp['P1X'], 'p1y' => $cp['P1Y'], 'p2x' => $cp['P2X'], 'p2y' => $cp['P2Y'] ) ); $this->_getFillStyle($key); $this->_getLineStyle($key); $this->_canvas->polygon(array('connect' => true)); } } unset($keys); } $this->_drawMarker(); $this->_clip(false); $this->_canvas->endGroup($this->_title); return parent::_done(); } } ?>