<?php require_once "../../ScatterPlot.class.php"; $graph = new Graph(280, 280); $graph->title->move(-40, 0); $graph->title->set('Two circles'); $group = new PlotGroup(); $group->setBackgroundGradient(new LinearGradient(new VeryLightGray(), new Color(245, 245, 245), 0)); $group->setPadding(25, 20, 40, 15); $group->setSpace(5, 5, 5, 5); $group->legend->setPosition(0.82, 0.1); $group->legend->setAlign(LEGEND_CENTER, LEGEND_MIDDLE); function getCircle($size) { $center = 0; $x = array(); $y = array(); for ($i = 0; $i <= 20; $i++) { $rad = $i / 20 * 2 * M_PI; $x[] = $center + cos($rad) * $size; $y[] = $center + sin($rad) * $size; } return array($x, $y); } list($x, $y) = getCircle(3); $plot = new ScatterPlot($y, $x); $plot->link(TRUE, new DarkBlue()); $plot->mark->setFill(new DarkPink()); $plot->mark->setType(MARK_CIRCLE, 6); $group->legend->add($plot, 'Circle #1', LEGEND_MARK); $group->add($plot);
} $graph = new Graph(280, 200); $graph->setAntiAliasing(TRUE); $group = new PlotGroup(); $group->setSpace(5, 5, 15, 0); $group->setPadding(40, 40); $group->axis->left->setLabelPrecision(2); $group->axis->right->setLabelPrecision(2); $colors = array(new Color(80, 105, 190, 10), new Color(105, 190, 80, 10)); $darkColor = array(new Color(40, 55, 120, 10), new Color(55, 120, 40, 10)); $axis = array(PLOT_LEFT, PLOT_RIGHT); $group->axis->left->setColor($darkColor[0]); $group->axis->left->label->setColor($darkColor[0]); $group->axis->right->setColor($darkColor[1]); $group->axis->right->label->setColor($darkColor[1]); $group->setBackgroundGradient(new LinearGradient(new Color(225, 225, 225), new Color(255, 255, 255), 0)); for ($n = 0; $n < 2; $n++) { $x = array(); for ($i = 0; $i < 4; $i++) { $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * ($n % 2 ? -0.5 : 1) + ($n % 2 ? -0.4 : 0) + 1; } $plot = new BarPlot($x, $n + 1, 2); $plot->barBorder->setColor(new Color(0, 0, 0, 30)); $plot->setBarPadding(0.1, 0.1); $plot->setBarSpace(5); $plot->barShadow->setSize(3); $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); $plot->barShadow->setColor(new Color(180, 180, 180, 10)); $plot->barShadow->smooth(TRUE); $plot->label->set($x); $plot->label->move(0, -6);
<?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 "../../BarPlot.class.php"; $graph = new Graph(280, 280); $graph->setAntiAliasing(TRUE); $group = new PlotGroup(); $group->setSpace(6, 6, 5, 5); $group->setBackgroundGradient(new LinearGradient(new Color(235, 235, 235), new White(), 0)); $group->setPadding(40, 10, 10, 50); $group->axis->left->setLabelPrecision(2); $group->axis->bottom->label->hide(TRUE); $group->axis->bottom->hideTicks(TRUE); $group->grid->setType(LINE_DASHED); $group->grid->hideHorizontal(TRUE); $gradients = array(new LinearGradient(new Color(30, 30, 160, 10), new Color(120, 120, 160, 10), 0), new LinearGradient(new Color(30, 160, 30, 10), new Color(120, 160, 120, 10), 0), new LinearGradient(new Color(160, 30, 30, 10), new Color(160, 120, 120, 10), 0)); for ($n = 0; $n < 3; $n++) { $x = array(); for ($i = 0; $i < 6; $i++) { $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 900) / 1000 - 0.5) * ($n % 2 ? -0.5 : 1) + ($n % 2 ? -0.4 : 0); } $plot = new BarPlot($x, $n + 1, 3); $plot->setXAxis(PLOT_BOTTOM); $plot->barShadow->setSize(1); $plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. * */ require_once "../../BarPlot.class.php"; function color($a = NULL) { if ($a === NULL) { $a = 0; } return new Color(mt_rand(20, 180), mt_rand(20, 180), mt_rand(20, 180), $a); } $graph = new Graph(400, 400); $graph->setAntiAliasing(TRUE); $group = new PlotGroup(); $group->setSpace(3, 3, 5, 5); $group->setBackgroundGradient(new LinearGradient(new Color(200, 200, 200), new Color(240, 240, 240), 0)); $group->setPadding(NULL, NULL, 25, 25); $group->axis->left->setLabelPrecision(2); for ($n = 0; $n < 4; $n++) { $x = array(); for ($i = 0; $i < 5; $i++) { $x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * ($n % 2 ? -0.5 : 1) + ($n % 2 ? -0.4 : 0); } $plot = new BarPlot($x, $n + 1, 4); $plot->barBorder->hide(); $plot->setXAxis(PLOT_TOP); $plot->barShadow->setSize(4); $plot->barShadow->setPosition(SHADOW_RIGHT_TOP); $plot->barShadow->setColor(new Color(255, 255, 255, 20)); $plot->barShadow->smooth(TRUE); $plot->setBarGradient(new LinearGradient(color(50), color(50), 90));