public function create() { $legend = $this->getArg('legend'); $y = $this->getArg('y'); if ($y === NULL) { awImage::drawError("Class LightLinePattern: Argument 'y' must not be NULL."); } $plot = new LinePlot($y); $plot->setSize(0.7, 1); $plot->setCenter(0.35, 0.5); $plot->setPadding(35, 15, 35, 30); $plot->setColor(new Orange()); $plot->setFillColor(new LightOrange(80)); $plot->grid->setType(Line::DASHED); $plot->mark->setType(Mark::CIRCLE); $plot->mark->setFill(new MidRed()); $plot->mark->setSize(6); $plot->legend->setPosition(1, 0.5); $plot->legend->setAlign(Legend::LEFT); $plot->legend->shadow->smooth(TRUE); if ($legend !== NULL) { $plot->legend->add($plot, $legend, Legend::MARK); } return $plot; }
* 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(375, 200); // Set title $graph->title->set('Star marks'); $graph->title->setFont(new Tuffy(12)); $graph->title->setColor(new DarkRed()); $plot = new LinePlot(array(5, 3, 4, 7, 6, 5, 8, 4, 7)); // Change plot size and position $plot->setSize(0.76, 1); $plot->setCenter(0.38, 0.5); $plot->setPadding(30, 15, 38, 25); $plot->setColor(new Orange()); $plot->setFillColor(new LightOrange(80)); // Change grid style $plot->grid->setType(LINE_DASHED); // Add customized marks $plot->mark->setType(MARK_STAR); $plot->mark->setFill(new MidRed()); $plot->mark->setSize(6); // Change legend $plot->legend->setPosition(1, 0.5); $plot->legend->setAlign(LEGEND_LEFT); $plot->legend->shadow->smooth(TRUE); $plot->legend->add($plot, 'My line', LEGEND_MARK); $graph->add($plot);
* 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"; function color($a = NULL) { if ($a === NULL) { $a = mt_rand(0, 100); } return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); } $graph = new Graph(400, 300); $graph->setBackgroundColor(new Color(175, 175, 175)); $x = array(mt_rand(-20, 20), 42, mt_rand(-20, 20), 15, 80, 42, 42, mt_rand(-20, 20)); $plot = new LinePlot($x); $plot->setBackgroundImage(new FileImage("42.png")); $plot->setAbsSize(350, 250); $plot->setCenter(0.5, 0.5); $plot->setThickness(mt_rand(4, 6)); $plot->setFillColor(color()); $plot->grid->setColor(new Color(0, 200, 42)); $plot->grid->hide(FALSE); $plot->grid->setColor(new Color(255, 25, 160)); $plot->yAxis->label->hideFirst(FALSE); $plot->yAxis->label->setFont(new Font2()); $plot->xAxis->setNumberByTick('minor', 'major', 2); $plot->xAxis->label->hideFirst(TRUE); $graph->add($plot); $graph->draw();
$plot->setBackgroundGradient(new LinearGradient(color(), color(), mt_rand(0, 1) * 90)); } else { $plot->setBackgroundColor(color()); } $mark = mt_rand(1, 2); $plot->mark->setType($mark); $plot->mark->setSize(mt_rand(3, 16)); $plot->mark->border->show(); if ($mark === 1 or mt_rand(0, 1) === 1) { $plot->mark->setFill(color()); } else { $plot->mark->setFill(new LinearGradient(color(), color(), 0)); } $plot->mark->border->setColor(color()); $plot->setSize(0.33 + $i / 2 + mt_rand(0, 15) / 100, 0.33 + mt_rand(0, 15) / 100); $plot->setCenter(0.25 + $i / 4 + (1 - $i) * mt_rand(0, 40) / 100, 0.25 + $i / 2 - $i * mt_rand(0, 10) / 100); $plot->grid->setColor(new Color(160, 200 * ($i - 1), 42 * $i)); $plot->grid->hide(FALSE); $plot->grid->setBackgroundColor(new Color(235 - 20 * $i, 235 + 20 * $i, 180, 50)); $plot->setYAxis(mt_rand(0, 1) ? PLOT_RIGHT : PLOT_LEFT); $plot->setXAxis(mt_rand(0, 1) ? PLOT_TOP : PLOT_BOTTOM); $plot->setPadding(NULL, NULL, 40, NULL); $plot->yAxis->label->hideFirst((bool) $i); $plot->yAxis->setLabelPrecision(2 - $i); $plot->yAxis->setColor(new Color(124 / ($i + 1), 50, 20)); $plot->yAxis->setNumberByTick('minor', 'major', $i * 2); $plot->yAxis->label->setFont(new Font3()); $plot->yAxis->label->setAngle($i ? 90 : 0); $plot->yAxis->label->setColor(new Color(124 / ($i + 1), 20, 200)); $plot->xAxis->setNumberByTick('minor', 'major', 2 + $i); $plot->xAxis->setLabelInterval(2 - $i);