Exemplo n.º 1
0
<?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 "../LinePlot.class.php";
// Use cache
$graph = new Graph(400, 400);
$graph->setAntiAliasing(TRUE);
$graph->border->setStyle(LINE_DOTTED);
$graph->border->setColor(new Red());
$x = array();
for ($i = 0; $i < 10; $i++) {
    $x[] = mt_rand(20, 100);
}
$plot = new LinePlot($x);
$plot->setFilledArea(0, 1, new Red(40));
$plot->setFilledArea(1, 2, new LinearGradient(new Red(40), new Orange(40), 90));
$plot->setFilledArea(2, 4, new LinearGradient(new Orange(40), new Green(40), 90));
$plot->setFilledArea(4, 7, new LinearGradient(new Green(40), new Blue(40), 90));
$plot->setFilledArea(7, 8, new LinearGradient(new Blue(40), new Purple(40), 90));
$plot->setFilledArea(8, 9, new Purple(40));
$graph->add($plot);
$graph->draw();
Exemplo n.º 2
0
 * 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 "../../LinePlot.class.php";
$graph = new Graph(300, 200);
$graph->setAntiAliasing(TRUE);
$x = array(-4, -5, -2, -8, -3, 1, 4, 9, 5, 6, 2);
$plot = new LinePlot($x);
$plot->setStyle(LINE_DASHED);
$plot->setSpace(4, 4, 10, 0);
$plot->setPadding(25, 15, 10, 18);
$plot->setBackgroundGradient(new LinearGradient(new Color(230, 230, 230), new Color(255, 255, 255), 90));
$plot->setFilledArea(7, 9, new Red(25));
$plot->setFilledArea(1, 4, new Yellow(25));
$plot->setColor(new Color(0, 0, 150, 20));
$plot->grid->setColor(new VeryLightGray());
$plot->mark->setType(MARK_SQUARE);
$plot->mark->setSize(4);
$plot->mark->setFill(new VeryDarkGreen(30));
$plot->mark->border->show();
$plot->mark->border->setColor(new DarkBlue(60));
$plot->xAxis->label->hide(TRUE);
$plot->xAxis->setNumberByTick('minor', 'major', 3);
$plot->yAxis->setLabelNumber(8);
$plot->legend->add($plot, "My line");
$plot->legend->setPosition(0.9, 0.77);
$graph->add($plot);
$graph->draw();
Exemplo n.º 3
0
<?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 "../LinePlot.class.php";
$graph = new Graph(400, 300);
$x = array(-4, -5, -2, -8, -3, 1, 4, 9, 5, 6, 2);
$plot = new LinePlot($x);
// Filled an area with a color
$plot->setFilledArea(7, 9, new DarkGreen(25));
// Filled the area with a gradient
$gradient = new LinearGradient(new Yellow(25), new Orange(25), 90);
$plot->setFilledArea(1, 4, $gradient);
// Hide first label
$plot->xAxis->label->hideFirst(TRUE);
$graph->add($plot);
$graph->draw();