本文整理汇总了PHP中Graph::setBackgroundGradient方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::setBackgroundGradient方法的具体用法?PHP Graph::setBackgroundGradient怎么用?PHP Graph::setBackgroundGradient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::setBackgroundGradient方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw_artichow
/**
* Build a graph onto disk using Artichow library
*
* @param string $file Image file name to use if we save onto disk
* @param string $fileurl Url path to show image if saved onto disk
* @return void
*/
private function draw_artichow($file, $fileurl)
{
global $artichow_defaultfont;
dol_syslog(get_class($this) . "::draw_artichow this->type=" . join(',', $this->type));
if (!defined('SHADOW_RIGHT_TOP')) {
define('SHADOW_RIGHT_TOP', 3);
}
if (!defined('LEGEND_BACKGROUND')) {
define('LEGEND_BACKGROUND', 2);
}
if (!defined('LEGEND_LINE')) {
define('LEGEND_LINE', 1);
}
// Create graph
$classname = '';
if (!isset($this->type[0]) || $this->type[0] == 'bars') {
$classname = 'BarPlot';
} else {
if ($this->type[0] == 'lines') {
$classname = 'LinePlot';
} else {
$classname = 'TypeUnknown';
}
}
include_once ARTICHOW_PATH . $classname . '.class.php';
// Definition de couleurs
$bgcolor = new Color($this->bgcolor[0], $this->bgcolor[1], $this->bgcolor[2]);
$bgcolorgrid = new Color($this->bgcolorgrid[0], $this->bgcolorgrid[1], $this->bgcolorgrid[2]);
$colortrans = new Color(0, 0, 0, 100);
$colorsemitrans = new Color(255, 255, 255, 60);
$colorgradient = new LinearGradient(new Color(235, 235, 235), new Color(255, 255, 255), 0);
$colorwhite = new Color(255, 255, 255);
// Graph
$graph = new Graph($this->width, $this->height);
$graph->border->hide();
$graph->setAntiAliasing(true);
if (isset($this->title)) {
$graph->title->set($this->title);
//print $artichow_defaultfont;exit;
$graph->title->setFont(new $artichow_defaultfont(10));
}
if (is_array($this->bgcolor)) {
$graph->setBackgroundColor($bgcolor);
} else {
$graph->setBackgroundGradient($colorgradient);
}
$group = new PlotGroup();
//$group->setSpace(5, 5, 0, 0);
$paddleft = 50;
$paddright = 10;
$strl = dol_strlen(max(abs($this->MaxValue), abs($this->MinValue)));
if ($strl > 6) {
$paddleft += $strl * 4;
}
$group->setPadding($paddleft, $paddright);
// Width on left and right for Y axis values
$group->legend->setSpace(0);
$group->legend->setPadding(2, 2, 2, 2);
$group->legend->setPosition(NULL, 0.1);
$group->legend->setBackgroundColor($colorsemitrans);
if (is_array($this->bgcolorgrid)) {
$group->grid->setBackgroundColor($bgcolorgrid);
} else {
$group->grid->setBackgroundColor($colortrans);
}
if ($this->hideXGrid) {
$group->grid->hideVertical(true);
}
if ($this->hideYGrid) {
$group->grid->hideHorizontal(true);
}
// 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);
//.........这里部分代码省略.........
示例2: 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 "../../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();
示例3: if
if (empty($_GET['donnee_label']) and empty($_POST['donnee_label'])) { $donnee_label = ''; }
else { if (isset($_GET['donnee_label'])) { $donnee_label = $_GET['donnee_label']; } if (isset($_POST['donnee_label'])) { $donnee_label = $_POST['donnee_label']; } }
if (empty($_GET['export_pdf']) and empty($_POST['export_pdf'])) { $export_pdf = ''; }
else { if (isset($_GET['export_pdf'])) { $export_pdf = $_GET['export_pdf']; } if (isset($_POST['export_pdf'])) { $export_pdf = $_POST['export_pdf']; } }
// LE GRAPHIQUE
$graph = new Graph(550, 250);
$graph->shadow->setPosition(Shadow::RIGHT_BOTTOM);
$graph->shadow->setSize(4);
$graph->setBackgroundGradient(
new LinearGradient(
new Color(240, 240, 240, 0),
new White,
0
)
);
$genres = array(
'Janvier' => 60,
'Février' => 135,
'Mars' => 30,
'Avril' => 60,
'Mai' => 15,
'Juin' => 60,
'Juillet' => 135,
'Aout' => 30,
'Septembre' => 60,
'Octobre' => 15,
示例4: Artichow_Pie
/**
* Формирование диаграммы.
*
* Функция формирует, а затем записывает в файл ($File) изображение диаграммы по
* переданным пользователем данным($Lines).
*
* @param string <заголовок диаграммы>
* @param string <полный путь с именем файла-результата>
* @param array <исходные данные>
* @param array <легенда диаграммы>
*/
function Artichow_Pie($Name, $File, $Lines, $Labels)
{
#-----------------------------------------------------------------------------
$Graph = new Graph(500, 400);
$Graph->setDriver('gd');
$Graph->setAntiAliasing(TRUE);
$Graph->setBackgroundGradient(new LinearGradient(new Color(240, 240, 240, 0), new White(), 0));
#-----------------------------------------------------------------------------
$Graph->title->set($Name);
$Graph->title->setFont(new Tuffy(15));
#-----------------------------------------------------------------------------
$Pie = new Pie($Lines, array(new LightOrange(), new LightPurple(), new LightBlue(), new LightRed(), new LightPink(), new VeryDarkGreen(), new MidBlue(), new VeryDarkCyan(), new Cyan(), new DarkOrange(), new VeryLightOrange()));
$Pie->setCenter(0.3, 0.5);
$Pie->setAbsSize(300, 300);
$Pie->setPadding(40, 40, 40, 40);
$Pie->setLegend($Labels);
#-----------------------------------------------------------------------------
$Pie->legend->setTextFont(new Tuffy(7));
$Pie->legend->setPosition(1.6, 0.5);
#-----------------------------------------------------------------------------
$Pie->title->move(0, -40);
$Pie->title->setFont(new Tuffy(14));
$Pie->title->setBackgroundColor(new White(50));
$Pie->title->setPadding(5, 5, 2, 2);
$Pie->title->border->setColor(new Black());
#-----------------------------------------------------------------------------
$Graph->add($Pie);
#-----------------------------------------------------------------------------
$Graph->draw($File);
#-----------------------------------------------------------------------------
return TRUE;
}
示例5: Color
/**
* Build a graph onto disk using Artichow library
* @param file Image file name on disk
*/
function draw_artichow($file)
{
dol_syslog("DolGraph.class::draw_artichow this->type=".$this->type);
if (! defined('SHADOW_RIGHT_TOP')) define('SHADOW_RIGHT_TOP',3);
if (! defined('LEGEND_BACKGROUND')) define('LEGEND_BACKGROUND',2);
if (! defined('LEGEND_LINE')) define('LEGEND_LINE',1);
// Create graph
$classname='';
if ($this->type == 'bars') $classname='BarPlot';
if ($this->type == 'lines') $classname='LinePlot';
include_once DOL_DOCUMENT_ROOT."/includes/artichow/".$classname.".class.php";
// Definition de couleurs
$bgcolor=new Color($this->bgcolor[0],$this->bgcolor[1],$this->bgcolor[2]);
$bgcolorgrid=new Color($this->bgcolorgrid[0],$this->bgcolorgrid[1],$this->bgcolorgrid[2]);
$colortrans=new Color(0,0,0,100);
$colorsemitrans=new Color(255,255,255,60);
$colorgradient= new LinearGradient(new Color(235, 235, 235),new Color(255, 255, 255),0);
$colorwhite=new Color(255,255,255);
// Graph
$graph = new Graph($this->width, $this->height);
$graph->border->hide();
$graph->setAntiAliasing(true);
if (isset($this->title))
{
$graph->title->set($this->title);
$graph->title->setFont(new Tuffy(10));
}
if (is_array($this->bgcolor)) $graph->setBackgroundColor($bgcolor);
else $graph->setBackgroundGradient($colorgradient);
$group = new PlotGroup;
//$group->setSpace(5, 5, 0, 0);
$paddleft=50;
$paddright=10;
$strl=dol_strlen(max(abs($this->MaxValue),abs($this->MinValue)));
if ($strl > 6) $paddleft += ($strln * 4);
$group->setPadding($paddleft, $paddright); // Width on left and right for Y axis values
$group->legend->setSpace(0);
$group->legend->setPadding(2,2,2,2);
$group->legend->setPosition(NULL,0.1);
$group->legend->setBackgroundColor($colorsemitrans);
if (is_array($this->bgcolorgrid)) $group->grid->setBackgroundColor($bgcolorgrid);
else $group->grid->setBackgroundColor($colortrans);
if ($this->hideXGrid) $group->grid->hideVertical(true);
if ($this->hideYGrid) $group->grid->hideHorizontal(true);
// On boucle sur chaque lot de donnees
$legends=array();
$i=0;
$nblot=sizeof($this->data[0])-1;
while ($i < $nblot)
{
$j=0;
$values=array();
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);
//.........这里部分代码省略.........
示例6: getImage_p
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;
}