public function drawComponent(awDriver $driver, $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) { $driver->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness)); } $prev = $point; } } // 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)); $driver->line($this->impulse, new awLine($zero, $point, awLine::SOLID, 1)); } } } // Draw marks and labels foreach ($polygon->all() as $key => $point) { $this->mark->draw($driver, $point); $this->label->draw($driver, $point, $key); } }
public function drawComponent(awDriver $driver, $x1, $y1, $x2, $y2, $aliasing) { $max = $this->getRealYMax(); $min = $this->getRealYMin(); // Get start and stop values list($start, $stop) = $this->getLimit(); if ($this->lineMode === awLinePlot::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 ($this->lineBackground instanceof awColor or $this->lineBackground instanceof 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(clone $point); } $p = $this->xAxisPoint($stop); $p = $p->move($inc, 0); $backgroundPolygon->append($p); // Draw polygon background $driver->filledPolygon($this->lineBackground, $backgroundPolygon); } $this->drawArea($driver, $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) { $driver->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness)); } $prev = $point; } } // Draw marks and labels foreach ($polygon->all() as $key => $point) { $this->mark->draw($driver, $point); $this->label->draw($driver, $point, $key); } }