Exemple #1
0
 /**
  * Output the Bezier smoothed plot as an Line Chart
  *
  * @return bool Was the output 'good' (true) or 'bad' (false).
  * @access private
  */
 function _done()
 {
     if (parent::_done() === false) {
         return false;
     }
     $this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
     $this->_clip(true);
     $keys = array_keys($this->_dataset);
     foreach ($keys as $key) {
         $dataset =& $this->_dataset[$key];
         $dataset->_reset();
         $numPoints = 0;
         while ($p1 = $dataset->_next()) {
             if ($p1['Y'] === null) {
                 if ($numPoints > 1) {
                     $this->_getLineStyle($key);
                     $this->_canvas->polygon(array('connect' => false, 'map_vertices' => true));
                 } else {
                     $this->_canvas->reset();
                 }
                 $numPoints = 0;
             } else {
                 $p0 = $dataset->_nearby(-2);
                 $p2 = $dataset->_nearby(0);
                 $p3 = $dataset->_nearby(1);
                 if ($p0 && $p0['Y'] === null) {
                     $p0 = false;
                 }
                 if ($p2 && $p2['Y'] === null) {
                     $p2 = false;
                 }
                 if ($p3 && $p3['Y'] === null) {
                     $p3 = false;
                 }
                 if ($p2) {
                     $cp = $this->_getControlPoints($p1, $p0, $p2, $p3);
                     $this->_canvas->addSpline($this->_mergeData($p1, array('x' => $cp['X'], 'y' => $cp['Y'], 'p1x' => $cp['P1X'], 'p1y' => $cp['P1Y'], 'p2x' => $cp['P2X'], 'p2y' => $cp['P2Y'])));
                 } else {
                     $x = $this->_pointX($p1);
                     $y = $this->_pointY($p1);
                     $this->_canvas->addVertex($this->_mergeData($p1, array('x' => $x, 'y' => $y)));
                 }
                 $numPoints++;
             }
         }
         if ($numPoints > 1) {
             $this->_getLineStyle();
             $this->_canvas->polygon(array('connect' => false, 'map_vertices' => true));
         } else {
             $this->_canvas->reset();
         }
     }
     unset($keys);
     $this->_drawMarker();
     $this->_clip(false);
     $this->_canvas->endGroup();
     return true;
 }
Exemple #2
0
 /**
  * Output the Bezier smoothed plot as an Area Chart
  *
  * @return bool Was the output 'good' (true) or 'bad' (false).
  * @access private
  */
 function _done()
 {
     if (parent::_done() === false) {
         return false;
     }
     $this->_canvas->startGroup(get_class($this) . '_' . $this->_title);
     $this->_clip(true);
     $keys = array_keys($this->_dataset);
     foreach ($keys as $key) {
         $dataset =& $this->_dataset[$key];
         $dataset->_reset();
         $first = true;
         while ($p1 = $dataset->_next()) {
             $p0 = $dataset->_nearby(-2);
             $p2 = $dataset->_nearby(0);
             $p3 = $dataset->_nearby(1);
             if ($first) {
                 $p = $p1;
                 $p['Y'] = '#min_pos#';
                 $x = $this->_pointX($p);
                 $y = $this->_pointY($p);
                 $this->_canvas->addVertex(array('x' => $x, 'y' => $y));
             }
             if ($p2) {
                 $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']));
             } else {
                 $x = $this->_pointX($p1);
                 $y = $this->_pointY($p1);
                 $this->_canvas->addVertex(array('x' => $x, 'y' => $y));
             }
             $lastPoint = $p1;
             $first = false;
         }
         $lastPoint['Y'] = '#min_pos#';
         $x = $this->_pointX($lastPoint);
         $y = $this->_pointY($lastPoint);
         $this->_canvas->addVertex(array('x' => $x, 'y' => $y));
         $this->_getFillStyle($key);
         $this->_getLineStyle($key);
         $this->_canvas->polygon(array('connect' => true));
     }
     unset($keys);
     $this->_drawMarker();
     $this->_clip(false);
     $this->_canvas->endGroup();
     return true;
 }
Exemple #3
0
 /**
  * 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);
     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->_canvas->endGroup($this->_title);
     return parent::_done();
 }