function createPie($values, $title, $x, $y) { $plot = new Pie($values); $plot->title->set($title); $plot->title->setFont(new TuffyBold(8)); $plot->title->move(NULL, -12); $plot->label->setFont(new Tuffy(7)); $plot->legend->hide(TRUE); $plot->setLabelPosition(5); $plot->setSize(0.4, 0.4); $plot->setCenter($x, $y); $plot->setBorderColor(new Black()); return $plot; }
function createPie($values, $title, $x, $y) { $plot = new Pie($values, PIE_EARTH); $plot->title->set($title); $plot->title->setFont(new TuffyBold(9)); $plot->title->move(NULL, -12); $plot->label->setFont(new Tuffy(7)); $plot->legend->hide(TRUE); $plot->setLabelPosition(5); $plot->setSize(0.48, 0.35); $plot->setCenter($x, $y); $plot->set3D(8); $plot->setBorderColor(new White()); return $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 "../../Pie.class.php"; $graph = new Graph(300, 175); $graph->setBackgroundGradient(new LinearGradient(new White(), new VeryLightGray(40), 0)); $graph->title->set("Horses"); $graph->shadow->setSize(5); $graph->shadow->smooth(TRUE); $graph->shadow->setPosition(SHADOW_LEFT_BOTTOM); $graph->shadow->setColor(new DarkGray()); $values = array(8, 4, 6, 2, 5); $plot = new Pie($values); $plot->setCenter(0.35, 0.55); $plot->setSize(0.7, 0.6); $plot->set3D(10); $plot->setLabelPosition(10); $plot->setLegend(array('France', 'Spain', 'Italy', 'Germany', 'England')); $plot->legend->setPosition(1.4); $plot->legend->shadow->setSize(0); $plot->legend->setBackgroundColor(new VeryLightGray(30)); $graph->add($plot); $graph->draw();
// fond de couleur des étiquettes $pie->label->setBackgroundColor(new White(50)); // padding des étiquettes $pie->label->setPadding(2, 2, 2, 2); // la légende // tableau des noms dans la légende $pie->setLegend($x); // positionement de la légende $pie->legend->setPosition(1.45, .45); // le camember // positionement du camembert $pie->setCenter(.35, .50); // taille du camembert $pie->setSize(.60, .70); // encadrement des différentes partie du camembert // remplacer 1.0.9 par setBorderColor // $pie->setBorder(new Black()); $pie->setBorderColor(new Black()); // mode 3D du camembert $pie->set3D(15); // couleur de fond du camembert //$pie->setBackgroundColor(new White(0)); // part à séparer ? //$pie->explode(); // le titre // le texte du titre $pie->title->set($donnee_titre[0]); // emplacement du titre
$plot->setBarPadding(0.15, 0.15); $plot->label->set($data2); $plot->label->move(0, -5); $group->add($plot); } $graph->add($group); } else { if ($type == "pie") { require INCLUDE_PATH . "/Pie.class.php"; $graph = new Graph($width, $height); $graph->title->set($title); $graph->title->setFont(new Tuffy(11)); $colors = array(new Color(102, 205, 0), new Color(122, 197, 205), new Color(238, 197, 145), new Color(238, 180, 34), new LightOrange(), new LightPurple(), new LightBlue(), new LightRed(), new LightPink()); $plot = new Pie($data, $colors); $plot->setCenter(0.4, 0.55); $plot->setSize(0.65, 0.7); $plot->set3D(10); $plot->setLabelPosition(10); $plot->setLegend($keys); $plot->legend->setPosition(1.37); $plot->legend->shadow->setSize(0); $plot->legend->setBackgroundColor(new Color(235, 235, 235)); $graph->add($plot); } else { if ($type == "line" or $type == "linesteps") { require INCLUDE_PATH . "/LinePlot.class.php"; $graph = new Graph($width, $height); $graph->title->set($title); $graph->title->setFont(new Tuffy(11)); $group = new PlotGroup(); $group->setSpace(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 "../../Pie.class.php"; $graph = new Graph(300, 175); $graph->setBackgroundGradient(new LinearGradient(new VeryLightGray(40), new White(), 90)); $graph->title->set("Arbitrary labels"); $graph->title->setAngle(90); $graph->title->move(120, NULL); $values = array(8, 4, 6, 2, 5, 3, 4); $plot = new Pie($values); $plot->setCenter(0.45, 0.5); $plot->setSize(0.55, 0.55 * 300 / 175); $plot->label->set(array('Arthur', 'Abel', 'Bernard', 'Thierry', 'Paul', 'Gaston', 'Joe')); $plot->label->setCallbackFunction(NULL); // We must disable the default callback function $plot->setLabelPosition(10); $plot->setLegend(array('ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQR', 'STU')); $plot->legend->hide(TRUE); $graph->add($plot); $graph->draw();
<?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 "../Pie.class.php"; $graph = new Graph(400, 300); $graph->setBackgroundGradient(new LinearGradient(new VeryLightGray(), new White(), 0)); $graph->title->set("Pie (example 15) - Arbitrary labels"); $values = array(8, 4, 6, 2, 5, 3, 4); $plot = new Pie($values); $plot->setCenter(0.4, 0.55); $plot->setSize(0.6, 0.6 * 4 / 3); $plot->label->set(array('Arthur', 'Abel', 'Bernard', 'Thierry', 'Paul', 'Gaston', 'Joe')); $plot->label->setCallbackFunction(NULL); // We must disable the default callback function $plot->setLegend(array('ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQR', 'STU')); $plot->legend->setPosition(1.3); $plot->legend->setBackgroundColor(new VeryLightGray(30)); $graph->add($plot); $graph->draw();
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. * */ require_once "../../Pie.class.php"; $graph = new Graph(400, 300); $graph->setTiming(TRUE); $graph->setAntiAliasing(TRUE); for ($i = 0; $i < 4; $i++) { $x = array(); for ($j = 0; $j < 6; $j++) { $x[] = mt_rand(35, 100); } $plot = new Pie($x, PIE_DARK); $plot->setStartAngle(mt_rand(0, 360)); $plot->title->set('Pie #' . $i); $plot->setSize(0.45, 0.45); $plot->setCenter($i % 2 / 2 + 0.2, $i > 1 ? 0.2 : 0.7); if (mt_rand(0, 1) === 1) { $plot->set3D(15); } $plot->setBorderColor(new Color(230, 230, 230)); $plot->explode(array(mt_rand(5, 35), 3 => 8)); if ($i === 3) { $plot->legend->setPosition(1.1, 1.0); } else { $plot->legend->setTextMargin(8, 0); $plot->legend->hide(TRUE); } $graph->add($plot); } $graph->draw();
<?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 "../Pie.class.php"; $graph = new Graph(400, 300); $graph->setAntiAliasing(TRUE); $graph->title->set("Pie (example 8)"); $values = array(8, 4, 6, 2, 5, 3, 4); $plot = new Pie($values, PIE_EARTH); $plot->setSize(0.85, 0.6); $plot->set3D(15); $plot->setBorderColor(new LightGray()); $plot->setLegend(array('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')); $plot->legend->shadow->setSize(3); $plot->legend->setModel(LEGEND_MODEL_BOTTOM); $plot->legend->setPosition(NULL, 1.1); $plot->label->setPadding(2, 2, 2, 2); $plot->label->border->setColor(new Red(60)); $plot->label->setFont(new Tuffy(7)); $plot->label->setBackgroundGradient(new LinearGradient(new Red(80), new White(80), 0)); $plot->setLabelPrecision(1); $graph->add($plot); $graph->draw();
* 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 "../../Pie.class.php"; function callbackLabel($value) { return ".:: *** ::.\n" . $value . "\n.:: *** ::."; } $graph = new Graph(400, 300); $x = array(); for ($i = 0; $i < 9; $i++) { $x[] = mt_rand(20, 100); } $plot = new Pie($x); $plot->setSize(0.6, 0.6); $plot->setCenter(0.4, 0.5); $plot->legend->shadow->setSize(4); $plot->legend->setPadding(10, 10, 10, 10); $plot->legend->setTextMargin(8, 0); $plot->legend->setPosition(1.45, 0.5); $plot->legend->setAlign(LEGEND_RIGHT); $plot->setLegend(array('Un', 'Deux', 'Trois', 'Quatre', 'Cinq', 'Six', 'Sept', 'Huit', 'Neuf')); $plot->setLabelNumber(6); $plot->setLabelMinimum(10); $plot->label->setCallbackFunction('callbackLabel'); $plot->label->setFont(new Tuffy(8)); $graph->add($plot); $graph->draw();
* 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 "../../Pie.class.php"; $graph = new Graph(400, 300); $graph->setTiming(TRUE); $graph->setAntiAliasing(TRUE); $graph->title->set("It's raining again"); $graph->title->setBackgroundColor(new White(25)); $graph->title->border->show(); $graph->title->setPadding(3, 3, 3, 3); $x = array(); for ($i = 0; $i < 7; $i++) { $x[] = mt_rand(20, 100); } $y = array('Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'); $plot = new Pie($x, PIE_AQUA); $plot->setCenter(0.5, 0.58); $plot->setSize(mt_rand(50, 100) / 100, mt_rand(50, 100) / 100); $plot->setLegend($y); $plot->setBorderColor(new Color(0, 0, 0)); $plot->label->hide(TRUE); //$plot->legend->add($plot, "Test", LEGEND_BACKGROUND); $plot->legend->setPadding(10, 10, 10, 10); $plot->legend->setTextMargin(8, 0); $plot->legend->shadow->setSize(4); $graph->add($plot); $graph->draw();
<?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 "../../Pie.class.php"; $graph = new Graph(400, 300); $graph->setTiming(TRUE); $graph->setAntiAliasing(TRUE); $graph->shadow->setSize(10); $graph->shadow->smooth(TRUE); $x = array(); for ($j = 0; $j < mt_rand(3, 6); $j++) { $x[] = mt_rand(35, 100); } $plot = new Pie($x, PIE_DARK); $plot->setSize(0.8, 0.8); $plot->setCenter(mt_rand(45, 55) / 100, mt_rand(45, 55) / 100); $plot->set3D(10); $plot->setBorderColor(new Color(230, 230, 230)); $plot->explode(array(1 => mt_rand(5, 50), 2 => mt_rand(5, 50), 3 => 12)); $plot->legend->setPadding(10, 10, 10, 10); $plot->legend->setTextMargin(8, 0); $plot->legend->hide(TRUE); $graph->add($plot); $graph->draw();
protected function getImage_p($id) { require_once "./protected/pages/components/velopark/artichow/Pie.class.php"; $sql = "SELECT id, area,filling, name FROM hr_vp_parking "; $cmd = $this->db->createCommand($sql); $data = $cmd->query(); $data = $data->read(); $graph = new Graph(500, 300); $graph->setBackgroundGradient(new LinearGradient(new White(), new VeryLightGray(40), 0)); $graph->title->set(Prado::localize("Service {name}", array("name" => utf8_decode($data['name'])))); $graph->shadow->setSize(3); $graph->shadow->smooth(TRUE); $graph->shadow->setPosition(Shadow::RIGHT_BOTTOM); $graph->shadow->setColor(new DarkGray()); $values = array($data['filling'], $data['area'] - $data['filling'] + 1.0E-9); //$values = array(22.0,0.000000001); $colors = array(new LightRed(), new LightGreen()); $plot = new Pie($values, $colors); $plot->setCenter(0.42, 0.55); $plot->setSize(0.7, 0.7); $plot->set3D(20); /*if($data['filling']>0) $plot->explode(array(1 => 10));*/ $plot->setLegend(array(utf8_decode(Prado::localize('Used')), utf8_decode(Prado::localize('Free')))); $plot->legend->setPosition(1.3); $plot->legend->shadow->setSize(0); $plot->legend->setBackgroundColor(new VeryLightGray(30)); $graph->add($plot); $graph->draw(); exit; }