本文整理汇总了PHP中BarPlot::setBarGradient方法的典型用法代码示例。如果您正苦于以下问题:PHP BarPlot::setBarGradient方法的具体用法?PHP BarPlot::setBarGradient怎么用?PHP BarPlot::setBarGradient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BarPlot
的用法示例。
在下文中一共展示了BarPlot::setBarGradient方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw
public function draw($format = false)
{
/* Make sure we have GD support. */
if (!function_exists('imagecreatefromjpeg')) {
die;
}
if ($format === false) {
$format = IMG_PNG;
}
$group = new PlotGroup();
$graph = new Graph($this->width, $this->height);
$graph->setFormat($format);
$graph->setBackgroundColor(new Color(0xf4, 0xf4, 0xf4));
$graph->shadow->setSize(3);
$graph->title->set($this->title);
$graph->title->setFont(new Tuffy(10));
$graph->title->setColor(new Color(0x0, 0x0, 0x8b));
$graph->border->setColor(new Color(187, 187, 187, 15));
$plot = new BarPlot($this->xValues);
$plot->setBarColor(new $this->color());
$plot->barBorder->hide(true);
$plot->setBarGradient(new LinearGradient(new $this->color(), new White(), 0));
$plot->setBarPadding(0.2, 0.2);
$group->axis->bottom->setLabelText($this->xLabels);
$group->axis->bottom->label->setFont(new Tuffy(8));
$plot2 = new LinePlot($this->xValues, LinePlot::MIDDLE);
$plot2->setColor(new DarkBlue());
$plot2->setThickness(1);
if (GRAPH_TREND_LINES) {
$group->add($plot2);
}
$group->add($plot);
$graph->add($group);
$graph->draw();
}
示例2: draw_artichow
//.........这里部分代码省略.........
// On boucle sur chaque lot de donnees
$legends = array();
$i = 0;
$nblot = count($this->data[0]) - 1;
while ($i < $nblot) {
$x = 0;
$values = array();
foreach ($this->data as $key => $valarray) {
$legends[$x] = $valarray[0];
$values[$x] = $valarray[$i + 1];
$x++;
}
// We fix unknown values to null
$newvalues = array();
foreach ($values as $val) {
$newvalues[] = is_numeric($val) ? $val : null;
}
if ($this->type[0] == 'bars') {
//print "Lot de donnees $i<br>";
//print_r($values);
//print '<br>';
$color = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2], 20);
$colorbis = new Color(min($this->datacolor[$i][0] + 50, 255), min($this->datacolor[$i][1] + 50, 255), min($this->datacolor[$i][2] + 50, 255), 50);
$colorgrey = new Color(100, 100, 100);
$colorborder = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2]);
if ($this->mode == 'side') {
$plot = new BarPlot($newvalues, $i + 1, $nblot);
}
if ($this->mode == 'depth') {
$plot = new BarPlot($newvalues, 1, 1, ($nblot - $i - 1) * 5);
}
$plot->barBorder->setColor($colorgrey);
//$plot->setBarColor($color);
$plot->setBarGradient(new LinearGradient($colorbis, $color, 90));
if ($this->mode == 'side') {
$plot->setBarPadding(0.1, 0.1);
}
if ($this->mode == 'depth') {
$plot->setBarPadding(0.1, 0.4);
}
if ($this->mode == 'side') {
$plot->setBarSpace(5);
}
if ($this->mode == 'depth') {
$plot->setBarSpace(2);
}
$plot->barShadow->setSize($this->SetShading);
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
$plot->barShadow->setColor(new Color(160, 160, 160, 50));
$plot->barShadow->smooth(TRUE);
//$plot->setSize(1, 0.96);
//$plot->setCenter(0.5, 0.52);
// Le mode automatique est plus efficace
$plot->SetYMax($this->MaxValue);
$plot->SetYMin($this->MinValue);
}
if ($this->type[0] == 'lines') {
$color = new Color($this->datacolor[$i][0], $this->datacolor[$i][1], $this->datacolor[$i][2], 20);
$colorbis = new Color(min($this->datacolor[$i][0] + 20, 255), min($this->datacolor[$i][1] + 20, 255), min($this->datacolor[$i][2] + 20, 255), 60);
$colorter = new Color(min($this->datacolor[$i][0] + 50, 255), min($this->datacolor[$i][1] + 50, 255), min($this->datacolor[$i][2] + 50, 255), 90);
$plot = new LinePlot($newvalues);
//$plot->setSize(1, 0.96);
//$plot->setCenter(0.5, 0.52);
$plot->setColor($color);
$plot->setThickness(1);
// Set line background gradient
示例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(400, 400);
$values = array(2, 6, 3, 2, 4);
$plot = new BarPlot($values);
$plot->setBarGradient(new LinearGradient(new LightBlue(25), new VeryLightOrange(25), 90));
$plot->setSpace(5, 5, NULL, NULL);
$plot->barShadow->setSize(4);
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
$plot->barShadow->smooth(TRUE);
$graph->add($plot);
$graph->draw();
示例4: PlotGroup
$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);
$plot->barShadow->setColor(new Color(160, 160, 160, 10));
$plot->barBorder->setColor($gradients[$n]->from);
$plot->setBarGradient($gradients[$n]);
$plot->setBarSpace(2);
$group->legend->add($plot, 'Bar#' . ($n + 1), LEGEND_BACKGROUND);
$group->add($plot);
}
$group->legend->setModel(LEGEND_MODEL_BOTTOM);
$group->legend->setPosition(NULL, 0.86);
$group->legend->shadow->hide();
$graph->add($group);
$graph->draw();
示例5: Color
//.........这里部分代码省略.........
foreach($this->data as $key => $valarray)
{
$legends[$j] = $valarray[0];
$values[$j] = $valarray[$i+1];
$j++;
}
// Artichow ne gere pas les valeurs inconnues
// Donc si inconnu, on la fixe a null
$newvalues=array();
foreach($values as $val)
{
$newvalues[]=(is_numeric($val) ? $val : null);
}
if ($this->type == 'bars')
{
//print "Lot de donnees $i<br>";
//print_r($values);
//print '<br>';
$color=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2],20);
$colorbis=new Color(min($this->datacolor[$i][0]+50,255),min($this->datacolor[$i][1]+50,255),min($this->datacolor[$i][2]+50,255),50);
$colorgrey=new Color(100,100,100);
$colorborder=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2]);
if ($this->mode == 'side') $plot = new BarPlot($newvalues, $i+1, $nblot);
if ($this->mode == 'depth') $plot = new BarPlot($newvalues, 1, 1, ($nblot-$i-1)*5);
$plot->barBorder->setColor($colorgrey);
//$plot->setBarColor($color);
$plot->setBarGradient( new LinearGradient($colorbis, $color, 90) );
if ($this->mode == 'side') $plot->setBarPadding(0.1, 0.1);
if ($this->mode == 'depth') $plot->setBarPadding(0.1, 0.4);
if ($this->mode == 'side') $plot->setBarSpace(5);
if ($this->mode == 'depth') $plot->setBarSpace(2);
$plot->barShadow->setSize($this->SetShading);
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
$plot->barShadow->setColor(new Color(160, 160, 160, 50));
$plot->barShadow->smooth(TRUE);
//$plot->setSize(1, 0.96);
//$plot->setCenter(0.5, 0.52);
// Le mode automatique est plus efficace
$plot->SetYMax($this->MaxValue);
$plot->SetYMin($this->MinValue);
}
if ($this->type == 'lines')
{
$color=new Color($this->datacolor[$i][0],$this->datacolor[$i][1],$this->datacolor[$i][2],20);
$colorbis=new Color(min($this->datacolor[$i][0]+20,255),min($this->datacolor[$i][1]+20,255),min($this->datacolor[$i][2]+20,255),60);
$colorter=new Color(min($this->datacolor[$i][0]+50,255),min($this->datacolor[$i][1]+50,255),min($this->datacolor[$i][2]+50,255),90);
$plot = new LinePlot($newvalues);
//$plot->setSize(1, 0.96);
//$plot->setCenter(0.5, 0.52);
$plot->setColor($color);
$plot->setThickness(1);
// Set line background gradient
示例6: Graph
$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));
$plot->setBarGradient(new LinearGradient(new Color(150, 150, 210, 0), new Color(230, 230, 255, 30), 0));
$y = array('Zoé', 'Yvan', 'Fred', 'Lucie', 'Ilia', 'Nino', 'Marie');
$plot->xAxis->setLabelText($y);
$plot->xAxis->label->setFont(new TuffyBold(7));
$graph->shadow->setSize(4);
$graph->shadow->setPosition(SHADOW_LEFT_TOP);
$graph->shadow->smooth(TRUE);
$graph->shadow->setColor(new Color(160, 160, 160));
$graph->add($plot);
$graph->draw();
示例7: Color
$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));
$group->add($plot);
$group->legend->add($plot, "Line #" . ($n + 1), LEGEND_BACKGROUND);
}
$group->legend->setAlign(LEGEND_CENTER, LEGEND_TOP);
$group->legend->setPosition(0.87, 0.1);
$graph->add($group);
$graph->draw();