Esempio 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";
$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");
<?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(450, 400);
$graph->setAntiAliasing(TRUE);
$values = array();
for ($i = 0; $i < 15; $i++) {
    $values[] = mt_rand(4, 20);
}
$graph->title->set('Mon graphique');
$plot = new LinePlot($values, LINEPLOT_MIDDLE);
$plot->setFillColor(new Color(0, 200, 0, 75));
$plot->mark->setType(MARK_CIRCLE);
$plot->mark->setSize(8);
$plot->mark->setFill(new Color(255, 255, 255));
$plot->mark->border->show();
$plot->setSpace(5, 5, 5, 5);
$plot->setBackgroundColor(new Color(240, 240, 240));
$graph->add($plot);
$graph->draw();
Esempio n. 3
0
<?php

require_once "../../LinePlot.class.php";
$graph = new Graph(400, 400);
$graph->setAntiAliasing(FALSE);
$values = array(1, 4, 5, -2.5, 3);
$plot = new LinePlot($values);
$plot->setBackgroundGradient(new LinearGradient(new Color(210, 210, 210), new Color(250, 250, 250), 0));
$plot->yAxis->setLabelPrecision(1);
$plot->setSpace(5, 5, NULL, NULL);
$graph->add($plot);
$graph->draw();
Esempio n. 4
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);
$graph->setAntiAliasing(TRUE);
$x = array(1, 2, 5, 0.5, 3, 8);
$plot = new LinePlot($x);
$plot->setSpace(6, 6, 10, 10);
$plot->setXAxisZero(FALSE);
// Set a background gradient
$plot->setBackgroundGradient(new LinearGradient(new Color(210, 210, 210), new Color(255, 255, 255), 0));
// Change line color
$plot->setColor(new Color(0, 0, 150, 20));
// Set line background gradient
$plot->setFillGradient(new LinearGradient(new Color(150, 150, 210), new Color(230, 230, 255), 90));
// Change mark type
$plot->mark->setType(MARK_CIRCLE);
$plot->mark->border->show();
$graph->add($plot);
$graph->draw();
Esempio n. 5
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(500, 100);
$graph->setAntiAliasing(TRUE);
$graph->border->hide();
$x = array();
for ($i = 0; $i < 20; $i++) {
    $x[] = mt_rand(4, 12);
}
$plot = new LinePlot($x);
$plot->setSpace(0, 0, 50, 0);
$plot->setPadding(3, 3, 3, 3);
$plot->setBackgroundGradient(new LinearGradient(new Color(230, 230, 230), new Color(255, 255, 255), 0));
$plot->setColor(new Color(0, 0, 180, 20));
$plot->setFillGradient(new LinearGradient(new Color(220, 220, 230, 25), new Color(240, 240, 255, 25), 90));
$plot->xAxis->hide(TRUE);
$plot->yAxis->hide(TRUE);
$graph->add($plot);
$graph->draw();