{ return $value . ' %'; } $graph = new Graph(400, 400); $graph->setTiming(TRUE); $graph->setAntiAliasing(TRUE); $x = array(); for ($i = 0; $i < 5; $i++) { $x[] = mt_rand(-20, 100); } $plot = new LinePlot($x); $plot->setBackgroundColor(color(80)); $plot->setXAxis(PLOT_BOTH); $plot->setYAxis(PLOT_BOTH); $plot->setColor(color()); $plot->setStyle(LINE_DOTTED); $plot->grid->hideHorizontal(TRUE); $plot->grid->setBackgroundColor(new Color(235, 235, 180, 60)); $plot->yAxis->setLabelNumber(mt_rand(0, 10)); $plot->yAxis->setLabelPrecision(1); $plot->xAxis->label->hideFirst(TRUE); $plot->xAxis->label->hideLast(TRUE); $plot->label->set($x); $plot->label->move(0, mt_rand(0, 20)); $plot->label->setCallbackFunction('label'); $plot->label->setColor(color(0)); $plot->label->setBackgroundColor(new Color(mt_rand(200, 240), mt_rand(200, 240), mt_rand(200, 240), mt_rand(0, 20))); $plot->label->border->setColor(color()); $plot->label->setPadding(mt_rand(0, 3), mt_rand(0, 3), mt_rand(0, 3), mt_rand(0, 3)); $plot->label->setAngle(mt_rand(0, 1) ? 0 : 90); $graph->add($plot);
<?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");
$plot->mark->setType(MARK_SQUARE); $group->add($plot); // pas de chiffre après la virgule $group->axis->left->setLabelPrecision(1); $group->axis->left->setColor($rouge); $group->axis->left->title->move(-5, 0); $group->axis->left->title->set("Absences"); // les retards $plot = new LinePlot($values_retards); $plot->xAxis->setLabelText($x); $plot->setColor($bleu); $plot->setYAxis(PLOT_RIGHT); //Plot::RIGHT // type de trait $plot->setStyle(LINE_DOTTED); //Line::DOTTED // Change le style de ligne (Line::SOLID, Line::DOTTED ou Line::DASHED). // point noir sur le graphique $plot->mark->setFill($bleu); $plot->mark->setType(MARK_CIRCLE); $plot->mark->setSize(7); $plot->mark->setFill(new White); $plot->mark->border->show(); /* * const int CIRCLE := 1 * const int SQUARE := 2 * const int TRIANGLE := 3 * const int INVERTED_TRIANGLE := 4 * const int RHOMBUS := 5