Source for file LinePlot.class.php
Documentation is available at LinePlot.class.php
* This work is hereby released into the Public Domain.
* To view a copy of the public domain dedication,
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
require_once dirname(__FILE__ ). "/Plot.class.php";
* @package linea21.externals
* Add marks to your line plot
* Labels on your line plot
* Construct a new awLinePlot
* @param array $values Some numeric values for Y axis
function awLinePlot($values, $mode = LINEPLOT_LINE) {
* @param int $start Begining of the area
* @param int $end End of the area
* @param mixed $background Background color or gradient of the area
awImage::drawError("Class LinePlot: End position can not be greater than begin position in setFilledArea().");
$this->areas[] = array((int) $start, (int) $stop, $background);
* Change line background color
* Change line background gradient
* Get the background color or gradient of an element of the component
* @return Color, Gradient
// Get start and stop values
list ($start, $stop) = $this->getLimit();
$inc = $this->xAxis->getDistance(0, 1) / 2;
for($key = $start; $key <= $stop; $key++ ) {
$value = $this->datay[$key];
$backgroundPolygon->append($p);
foreach($polygon->all() as $point) {
$backgroundPolygon->append($point);
$backgroundPolygon->append($p);
// Draw polygon background
foreach($polygon->all() as $point) {
foreach($polygon->all() as $key => $point) {
$this->mark->draw($driver, $point);
$this->label->draw($driver, $point, $key);
foreach($this->areas as $area) {
foreach($this->areas as $area) {
list ($start, $stop, $background) = $area;
$polygonArea->append($p);
for($i = $start; $i <= $stop; $i++ ) {
$polygonArea->append($p);
$polygonArea->append($p);
$driver->filledPolygon($background, $polygonArea);
* Useful to draw simple horizontal lines
* @package linea21.externals
* Construct a new awLinePlot
* @param float $value A Y value
* @param int $start Line start index
* @param int $stop Line stop index
* @param int $mode Line mode
function awSimpleLinePlot($value, $start, $stop, $mode = LINEPLOT_LINE) {
$inc = $this->xAxis->getDistance(0, 1) / 2;
|