function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $max = $this->getRealYMax();
     $min = $this->getRealYMin();
     // Get start and stop values
     list($start, $stop) = $this->getLimit();
     if ($this->lineMode === LINEPLOT_MIDDLE) {
         $inc = $this->xAxis->getDistance(0, 1) / 2;
     } else {
         $inc = 0;
     }
     // Build the polygon
     $polygon = new awPolygon();
     for ($key = $start; $key <= $stop; $key++) {
         $value = $this->datay[$key];
         if ($value !== NULL) {
             $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value));
             $p = $p->move($inc, 0);
             $polygon->set($key, $p);
         }
     }
     // Draw backgrounds
     if (is_a($this->lineBackground, 'awColor') or is_a($this->lineBackground, 'awGradient')) {
         $backgroundPolygon = new awPolygon();
         $p = $this->xAxisPoint($start);
         $p = $p->move($inc, 0);
         $backgroundPolygon->append($p);
         // Add others points
         foreach ($polygon->all() as $point) {
             $backgroundPolygon->append($point);
         }
         $p = $this->xAxisPoint($stop);
         $p = $p->move($inc, 0);
         $backgroundPolygon->append($p);
         // Draw polygon background
         $drawer->filledPolygon($this->lineBackground, $backgroundPolygon);
     }
     $this->drawArea($drawer, $polygon);
     // Draw line
     $prev = NULL;
     // Line color
     if ($this->lineHide === FALSE) {
         if ($this->lineColor === NULL) {
             $this->lineColor = new awColor(0, 0, 0);
         }
         foreach ($polygon->all() as $point) {
             if ($prev !== NULL) {
                 $drawer->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness));
             }
             $prev = $point;
         }
         $this->lineColor->free();
     }
     // Draw marks and labels
     foreach ($polygon->all() as $key => $point) {
         $this->mark->draw($drawer, $point);
         $this->label->draw($drawer, $point, $key);
     }
 }
 public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $count = count($this->datay);
     // Get start and stop values
     list($start, $stop) = $this->getLimit();
     // Build the polygon
     $polygon = new awPolygon();
     for ($key = 0; $key < $count; $key++) {
         $x = $this->datax[$key];
         $y = $this->datay[$key];
         if ($y !== NULL) {
             $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($x, $y));
             $polygon->set($key, $p);
         } else {
             if ($this->linkNull === FALSE) {
                 $polygon->set($key, NULL);
             }
         }
     }
     // Link points if needed
     if ($this->link) {
         $prev = NULL;
         foreach ($polygon->all() as $point) {
             if ($prev !== NULL and $point !== NULL) {
                 $drawer->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness));
             }
             $prev = $point;
         }
         $this->lineColor->free();
     }
     // Draw impulses
     if ($this->impulse instanceof awColor) {
         foreach ($polygon->all() as $key => $point) {
             if ($point !== NULL) {
                 $zero = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, 0));
                 $drawer->line($this->impulse, new awLine($zero, $point, awLine::SOLID, 1));
             }
         }
     }
     // Draw marks and labels
     foreach ($polygon->all() as $key => $point) {
         $this->mark->draw($drawer, $point);
         $this->label->draw($drawer, $point, $key);
     }
 }