本文整理汇总了PHP中BarPlot::setPadding方法的典型用法代码示例。如果您正苦于以下问题:PHP BarPlot::setPadding方法的具体用法?PHP BarPlot::setPadding怎么用?PHP BarPlot::setPadding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BarPlot
的用法示例。
在下文中一共展示了BarPlot::setPadding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Graph
* 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(400, 400);
// Set a title to the graph
$graph->title->set('The title');
// Change graph background color
$graph->setBackgroundColor(new Color(230, 230, 230));
$values = array(8, 2, 6, 1, 3, 5);
// Declare a new BarPlot
$plot = new BarPlot($values);
// Reduce padding around the plot
$plot->setPadding(NULL, NULL, NULL, 20);
// Reduce plot size and move it to the bottom of the graph
$plot->setSize(1, 0.96);
$plot->setCenter(0.5, 0.52);
// Set a background color to the plot
$plot->grid->setBackgroundColor(new White());
// Set a dashed grid
$plot->grid->setType(LINE_DASHED);
$plot->label->set($values);
$plot->label->move(0, -10);
$plot->label->setColor(new DarkBlue());
// Set a shadow to the bars
$plot->barShadow->setSize(2);
// Bar size is at 60%
$plot->setBarSize(0.6);
// Change the color of the bars
示例2: array
$plot->barShadow->smooth(TRUE);
$mois = array('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc');
$label = array();
foreach ($mois as $m) {
$label[] = $m;
}
$label[] = ' ';
foreach ($mois as $m) {
$label[] = $m;
}
$plot->xAxis->setLabelText($label);
/* ICI */
$max = array_max($values);
$yValues = array();
for ($i = 0; $i <= $max; $i++) {
$yValues[] = $i;
}
$plot->yAxis->setLabelText($yValues);
// Image::drawError(var_export($yValues, TRUE));
$plot->yAxis->setLabelText($yValues);
$plot->setPadding(30, 5, 20, 15);
$labelAvant = new Label("2005");
$labelAvant->setFont(new TTFFont(ARTICHOW_FONT . '/TuffyBold.ttf', 12));
$labelAvant->move(180, 10);
$labelMaintenant = new Label("2006");
$labelMaintenant->setFont(new TTFFont(ARTICHOW_FONT . '/TuffyBold.ttf', 12));
$labelMaintenant->move(450, 10);
$graph->add($plot);
$graph->addLabel($labelAvant, 0, 0);
$graph->addLabel($labelMaintenant, 0, 0);
$graph->draw();
示例3: Graph
<?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, 200);
$graph->setAntiAliasing(TRUE);
$x = array(1, 2, 5, 0.5, 3, 8, 6);
$plot = new BarPlot($x);
$plot->setSpace(4, 4, 10, 0);
$plot->setPadding(40, 15, 10, 40);
$plot->title->set("Zoé and friends");
$plot->title->setFont(new TuffyBold(11));
$plot->title->border->show();
$plot->title->setBackgroundColor(new Color(255, 255, 255, 25));
$plot->title->setPadding(4, 4, 4, 4);
$plot->title->move(-20, 25);
$plot->yAxis->title->set("Axe des Y");
$plot->yAxis->title->setFont(new TuffyBold(10));
$plot->yAxis->title->move(-4, 0);
$plot->yAxis->setTitleAlignment(LABEL_TOP);
$plot->xAxis->title->set("Axe des X");
$plot->xAxis->title->setFont(new TuffyBold(10));
$plot->xAxis->setTitleAlignment(LABEL_RIGHT);
$plot->setBackgroundGradient(new LinearGradient(new Color(230, 230, 230), new Color(255, 255, 255), 0));
$plot->barBorder->setColor(new Color(0, 0, 150, 20));