本文整理汇总了PHP中BarPlot::SetFillGradient方法的典型用法代码示例。如果您正苦于以下问题:PHP BarPlot::SetFillGradient方法的具体用法?PHP BarPlot::SetFillGradient怎么用?PHP BarPlot::SetFillGradient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BarPlot
的用法示例。
在下文中一共展示了BarPlot::SetFillGradient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderGraph
public function renderGraph()
{
require_once 'libs/jpgraph/jpgraph.php';
require_once 'libs/jpgraph/jpgraph_bar.php';
$graph = new Graph($this->_controllerAction->getRequest()->getParam('type') == 'month' ? 400 : 300, 200, 'auto');
$graph->SetMarginColor('white');
$graph->SetFrame(false);
$graph->SetScale("textlin");
$graph->img->SetMargin(0, 30, 20, 40);
$graph->yaxis->scale->SetGrace(20);
$graph->yaxis->HideLabels();
$graph->yaxis->HideTicks();
$graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCFF@0.5');
$labelsy = array();
$datay = array();
switch ($this->_controllerAction->getRequest()->getParam('type')) {
case 'month':
$this->_populateMonthData($labelsy, $datay);
break;
case 'year':
$this->_populateYearData($labelsy, $datay);
break;
default:
$this->_populateWeekData($labelsy, $datay);
}
$graph->xaxis->SetTickLabels($labelsy);
$bplot = new BarPlot($datay);
$bplot->SetFillGradient("navy", "lightsteelblue", GRAD_WIDE_MIDVER);
$bplot->value->Show();
$bplot->value->SetFormat('%d');
$graph->Add($bplot);
$graph->Stroke();
}
示例2: renderGraph
public function renderGraph()
{
require_once 'libs/jpgraph/jpgraph.php';
require_once 'libs/jpgraph/jpgraph_bar.php';
require_once 'libs/jpgraph/jpgraph_line.php';
$graph = new Graph(300, 200, 'auto');
$graph->SetMarginColor('white');
$graph->SetFrame(false);
$graph->SetScale("textlin");
$graph->SetY2Scale("lin");
$graph->img->SetMargin(0, 30, 20, 65);
$graph->yaxis->HideLabels();
$graph->yaxis->HideTicks();
$graph->yaxis->scale->SetGrace(20);
$graph->y2axis->SetColor("black", "red");
$graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCFF@0.5');
$labelsy = array();
$datay = array();
$datay2 = array();
switch ($this->_controllerAction->getRequest()->getParam('type')) {
case 'year':
$this->_populateYearData($labelsy, $datay, $datay2);
break;
default:
$this->_populateWeekData($labelsy, $datay, $datay2);
}
$graph->xaxis->SetTickLabels($labelsy);
$locale = Zend_Registry::get('Zend_Locale');
if ($locale == 'ja') {
// the ttf file for FF_MINCHO is already encoded in utf-8
$legend1 = $this->view->translate('Trusted sites');
$legend2 = $this->view->translate('Sites per user');
} else {
// default ttf files are latin-1 encoded
$legend1 = utf8_decode($this->view->translate('Trusted sites'));
$legend2 = utf8_decode($this->view->translate('Sites per user'));
}
$bplot = new BarPlot($datay);
$bplot->setLegend($legend1);
$bplot->SetFillGradient("navy", "lightsteelblue", GRAD_WIDE_MIDVER);
$bplot->value->Show();
$bplot->value->SetFormat('%d');
$p1 = new LinePlot($datay2);
$p1->SetColor("red");
$p1->SetLegend($legend2);
$graph->Add($bplot);
$graph->AddY2($p1);
$graph->legend->SetLayout(LEGEND_HOR);
if ($locale == 'ja') {
$graph->legend->setFont(FF_MINCHO, FS_NORMAL);
}
$graph->legend->Pos(0.5, 0.99, "center", "bottom");
$graph->Stroke();
}
示例3: executeBarGraph
public function executeBarGraph()
{
//Set the response header to a image JPEG datastream
$this->getResponse()->setContent('image/jpeg');
// Change this defines to where Your fonts are stored
DEFINE("TTF_DIR", "/usr/share/fonts/truetype/freefont/");
// Change this define to a font file that You know that You have
DEFINE("TTF_SANS", "FreeSans.ttf");
$util = new util();
$dataDVDrip = $util->getTotalFormat('DVDrip', 'movies');
$dataHDrip = $util->getTotalFormat('HDrip', 'movies');
$data720p = $util->getTotalFormat('720p', 'movies');
$data1080p = $util->getTotalFormat('1080p', 'movies');
$datay = array($dataDVDrip, $dataHDrip, $data720p, $data1080p);
$graph = new Graph(199, 145);
$graph->SetScale('textlin');
$graph->SetColor('black');
$graph->SetMarginColor('#393939');
$graph->SetFrame(true, '#393939');
$top = 25;
$bottom = 20;
$left = 50;
$right = 20;
$graph->Set90AndMargin($left, $right, $top, $bottom);
// Setup labels
$lbl = array("DVDrip", "HDrip", "720p", "1080p");
$graph->xaxis->SetTickLabels($lbl);
$graph->xaxis->SetColor('white');
$graph->xaxis->SetLabelAlign('right', 'center', 'right');
$graph->yaxis->SetLabelAlign('center', 'bottom');
$graph->yaxis->SetColor('white');
// Create a bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.5);
$bplot->SetFillGradient(array(250, 2, 2), array(109, 2, 2), GRAD_VERT);
$graph->Add($bplot);
$graph->Stroke();
return sfView::NONE;
}
示例4: Graph
// Setup the graph.
$graph = new Graph(400, 200);
$graph->img->SetMargin(60, 20, 30, 50);
$graph->SetScale("textlin");
$graph->SetMarginColor("silver");
$graph->SetShadow();
// Set up the title for the graph
$graph->title->Set("Example negative bars");
$graph->title->SetFont(FF_VERDANA, FS_NORMAL, 16);
$graph->title->SetColor("darkred");
// Setup font for axis
$graph->xaxis->SetFont(FF_VERDANA, FS_NORMAL, 10);
$graph->yaxis->SetFont(FF_VERDANA, FS_NORMAL, 10);
// Show 0 label on Y-axis (default is not to show)
$graph->yscale->ticks->SupressZeroLabel(false);
// Setup X-axis labels
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(50);
// Set X-axis at the minimum value of Y-axis (default will be at 0)
$graph->xaxis->SetPos("min");
// "min" will position the x-axis at the minimum value of the Y-axis
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);
// Setup color for gradient fill style
$bplot->SetFillGradient("navy", "steelblue", GRAD_MIDVER);
// Set color for the frame of each bar
$bplot->SetColor("navy");
$graph->Add($bplot);
// Finally send the graph to the browser
$graph->Stroke();
示例5: createhorizoncolumnar
/**
* 横柱图
*
*/
function createhorizoncolumnar($title, $subtitle, $data = array(), $size = 40, $height = 100, $width = 80, $legend = array())
{
vendor("Jpgraph.jpgraph");
vendor("Jpgraph.jpgraph_bar");
$datay = $data;
$datax = $legend;
//编码转化
foreach ($datax as $k => $v) {
$datax[$k] = iconv('utf-8', 'gb2312', $v);
}
// Size of graph
$count = count($datay);
$addheight = 0;
if ($count > 10) {
$addheight = ($count - 10) * 20;
}
$height = $height + $addheight;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale("textlin");
// No frame around the image
$graph->SetFrame(false);
$graph->SetFrame(false, '#ffffff', 0);
//去掉周围的边框
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(70, 10, 50, 30);
// Set white margin color
$graph->SetMarginColor('white');
// Use a box around the plot area
$graph->SetBox();
// Use a gradient to fill the plot area
$graph->SetBackgroundGradient('white', 'white', GRAD_HOR, BGRAD_PLOT);
// Setup title
$graph->title->Set(iconv('utf-8', 'gb2312', "{$title}"));
$graph->title->SetFont(FF_SIMSUN, FS_BOLD, 12);
$graph->subtitle->Set("(" . iconv('utf-8', 'gb2312', $subtitle) . ")");
$graph->subtitle->SetFont(FF_SIMSUN, FS_NORMAL, 10);
// Setup X-axis
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetFont(FF_SIMSUN, FS_NORMAL, 10);
// Some extra margin looks nicer
$graph->xaxis->SetLabelMargin(10);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('right', 'center');
// Add some grace to y-axis so the bars doesn't go
// all the way to the end of the plot area
$graph->yaxis->scale->SetGrace(10);
// We don't want to display Y-axis
$graph->yaxis->Hide();
// Now create a bar pot
$bplot = new BarPlot($datay);
//$bplot->SetShadow();
//You can change the width of the bars if you like
//$bplot->SetWidth(0.5);
// Set gradient fill for bars
$bplot->SetFillGradient('blue', '#0080C0', GRAD_HOR);
// We want to display the value of each bar at the top
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 7);
$bplot->value->SetAlign('left', 'center');
$bplot->value->SetColor("black");
$bplot->value->SetFormat('%.0f');
//$bplot->SetValuePos('max');
// Add the bar to the graph
$graph->Add($bplot);
// Add some explanation text
$txt = new Text('');
$txt->SetPos(130, 399, 'center', 'bottom');
$txt->SetFont(FF_COMIC, FS_NORMAL, 8);
$graph->Add($txt);
// .. and stroke the graph
$graph->Stroke();
}
示例6: BarPlot
//Setup Mian Title
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->title->Set("{$txt_7day}");
$graph->title->SetColor("{$textcolour}");
//Setup x axis
$graph->xaxis->SetColor("{$xtextcolour}");
$graph->xaxis->HideLabels(true);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->title->Set("{$txt_rain} ({$rain_unit})");
$graph->xaxis->title->SetColor("{$xtextcolour}");
// Setup y axis
$graph->yaxis->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->yaxis->SetColor("{$ytextcolour}");
$graph->yaxis->SetLabelFormat("{$rain_format}");
$graph->yaxis->HideTicks(true, true);
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.7);
$bplot->SetAlign("center");
$bplot->value->SetFont(FF_ARIAL, FS_BOLD);
$bplot->value->HideZero();
$bplot->value->SetColor("black");
$bplot->SetValuePos('top');
$bplot->value->Show();
$bplot->value->SetFormat("{$rain_format}");
$bplot->SetFillGradient("{$rain_col}", "#EEEEEE", GRAD_LEFT_REFLECTION);
$bplot->SetColor("{$rain_col}");
//Add plot
$graph->Add($bplot);
// Finally send the graph to the browser
$graph->Stroke();
示例7: GroupBarPlot
$ybplot1->value->SetMargin(5);
$ybplot1->value->SetAngle(60);
//$ybplot1->SetFormt('$%01.2f');
$ybplot1->SetFillGradient("#408CFF", "#F0F0FF", GRAD_HOR);
$ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
// Setup font for axis
//Bottom Lables
$graph->xaxis->SetFont(FF_GEORGIA, FS_NORMAL, 10);
$graph->xaxis->SetColor("#1B1B1B");
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(50);
//Left Lables
$graph->yaxis->SetFont(FF_GEORGIA, FS_NORMAL, 10);
$graph->yaxis->SetColor('#1B1B1B');
//$graph->y2axis->SetFont(FF_VERDANA,FS_NORMAL,10);
// Create the "Y2" axis group
$ybplot2 = new BarPlot($datay);
$ybplot2->value->Show();
$ybplot2->value->SetColor('#008000');
$ybplot2->value->SetFont(FF_ARIAL, FS_NORMAL, 8);
$ybplot2->value->SetMargin(0);
$ybplot2->value->SetAngle(60);
//$ybplot2->value->SetFormt('$%01.2f');
$ybplot2->SetFillGradient("#80FF80", "#E8FFE8", GRAD_HOR);
$y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
// Setup X-axis labels
// Add the grouped bar plots to the graph
$graph->Add($ybplot);
$graph->AddY2($y2bplot);
// .. and finally stroke the image back to browser
$graph->Stroke();
示例8: BarPlot
$graph->xaxis->HideTicks(false, false);
// Some extra margin looks nicer
$graph->xaxis->SetLabelMargin(4);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('center');
// Add some grace to y-axis so the bars doesn't go
// all the way to the end of the plot area
$graph->yaxis->scale->SetGrace(20);
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
// Create a bar pot
$bplot = new BarPlot($datay);
// Adjust fill color
$bplot->SetFillColor('#007acf');
$bplot->SetColor("white");
$bplot->SetFillGradient("#007acf", "white", GRAD_LEFT_REFLECTION);
//$bplot->SetWidth(45);
$graph->Add($bplot);
// Setup the titles
$graph->title->Set($grph_title);
$graph->xaxis->title->Set('Provider');
$graph->yaxis->title->Set('Total User');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Setup font for axis
$graph->xaxis->SetFont(FF_FONT1, FS_NORMAL, 10);
$graph->yaxis->SetFont(FF_FONT1, FS_NORMAL, 10);
// Display the graph
$graph->Stroke();
}
}
}
示例9: print_graph
//.........这里部分代码省略.........
$graph->yaxis->SetLabelMargin(4 * $k);
if ($ylabel) {
$graph->yaxis->title->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
$graph->yaxis->SetTitle($ylabel, 'middle');
$graph->yaxis->SetTitleMargin($yaxislblmargin * $k);
}
// Show 0 label on Y-axis (default is not to show)
$graph->yscale->ticks->SupressZeroLabel(false);
// Setup X-axis labels
$graph->xaxis->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
$graph->xaxis->SetTickLabels($legends);
$graph->xaxis->SetLabelAngle($xlangle);
$graph->xaxis->SetLabelMargin(4 * $k);
// X-axis title
if ($xlabel) {
$graph->xaxis->title->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
$graph->xaxis->SetTitle($xlabel, 'middle');
$graph->xaxis->SetTitleMargin($xaxislblmargin * $k);
}
$group = array();
foreach ($data as $series => $dat) {
$rdata = array();
foreach ($data[$series] as $row) {
$rdata[] = $row;
}
// Create the bar plot
$bplot = new BarPlot($rdata);
$bplot->SetWidth(0.6);
// for SINGLE??
// Setup color for gradient fill style
if ($bandw) {
$bplot->SetPattern($patterns[$series]);
} else {
$bplot->SetFillGradient($fills[$series], "#EEEEEE", GRAD_LEFT_REFLECTION);
}
// Set color for the frame of each bar
$bplot->SetColor("darkgray");
$bplot->SetLegend($labels[$series]);
if ($bandw) {
$bplot->SetShadow("gray5");
}
if ($show_values) {
$bplot->value->Show();
$bplot->value->SetMargin(6 * $k);
$bplot->value->SetColor("darkred");
$bplot->value->SetFont(FF_USERFONT, FS_NORMAL, 8 * $k);
if ($percent || $show_percent) {
$bplot->value->SetFormat('%d%%');
} else {
$bplot->value->SetFormat("%s");
}
}
$group[] = $bplot;
}
if (count($data) == 1) {
$graph->Add($group[0]);
} else {
// Create the grouped bar plot
if ($stacked) {
$gbplot = new AccBarPlot($group);
} else {
$gbplot = new GroupBarPlot($group);
}
$graph->Add($gbplot);
}
} else {
示例10: Graph
$datax = $title;
$datay = $count;
// Setup the graph.
$graph = new Graph(400, 300, 'auto', 10, true);
$graph->img->SetMargin(60, 20, 35, 75);
$graph->SetScale("textlin");
$graph->SetMarginColor("lightblue:1.1");
$graph->SetShadow();
// Set up the title for the graph
$graph->title->Set("Bar gradient with left reflection");
$graph->title->SetMargin(8);
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->title->SetColor("darkred");
// Setup font for axis
$graph->xaxis->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->SetFont(FF_FONT1, FS_BOLD);
// Show 0 label on Y-axis (default is not to show)
$graph->yscale->ticks->SupressZeroLabel(false);
// Setup X-axis labels
$graph->xaxis->SetTickLabels($datax);
//$graph->xaxis->SetLabelAngle(50);
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);
// Setup color for gradient fill style
$bplot->SetFillGradient("navy:0.9", "navy:1.85", GRAD_LEFT_REFLECTION);
// Set color for the frame of each bar
$bplot->SetColor("white");
$graph->Add($bplot);
// Finally send the graph to the browser
$graph->Stroke();
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:stats_comment_graph.php
示例11: array
$datay = array(0.3031, 0.3044, 0.3049, 0.304, 0.3024, 0.3047);
// Setup the graph.
$graph = new Graph(400, 200, "auto");
$graph->img->SetMargin(60, 30, 30, 40);
$graph->SetScale("textlin");
$graph->SetMarginColor("teal");
$graph->SetShadow();
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);
// This is how you make the bar graph start from something other than 0
$bplot->SetYMin(0.302);
// Setup color for gradient fill style
$tcol = array(100, 100, 255);
$fcol = array(255, 100, 100);
$bplot->SetFillGradient($fcol, $tcol, GRAD_VERT);
$bplot->SetFillColor("orange");
$graph->Add($bplot);
// Set up the title for the graph
//$graph->title->Set("Bargraph which doesn't start from y=0");
//$graph->title->SetColor("yellow");
//$graph->title->SetFont(FF_VERDANA,FS_BOLD,12);
// Setup color for axis and labels
$graph->xaxis->SetColor("black", "white");
$graph->yaxis->SetColor("black", "white");
// Setup font for axis
$graph->xaxis->SetFont(FF_VERDANA, FS_NORMAL, 10);
$graph->yaxis->SetFont(FF_VERDANA, FS_NORMAL, 10);
// Setup X-axis title (color & font)
$graph->xaxis->title->Set("X-axis");
$graph->xaxis->title->SetColor("white");
示例12: genererCourbe
/**
* Un tableau contenant les moyennes des eleves pour chaque sequences
*
* @param type $moyennes = array()
*/
function genererCourbe($moyennes, $rang, $codeperiode = "S")
{
try {
# Donnees de la courbe
$ydata = $moyennes;
$ydata2 = $moyennes;
/* for ($i = 1; $i <= 6; $i++) {
$r = rand(0, 20);
$ydata[] = $r;
$ydata2[] = $r;
} */
/** Definition des label de l'axe x */
if ($codeperiode === "T") {
$datax = array("TRIM1", "TRIM2", "TRIM3");
} else {
$datax = array("seq 1", "seq 2", "seq 3", "seq 4", "seq 5", "seq 6");
}
# Creation du graph
$graph = new Graph(350, 250, 'auto');
$graph->SetMarginColor('white');
# Definir le max et le min des valeur X
$graph->SetScale('textlin', 0, 20);
#$graph->xaxis->title->Set("Séquences");
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph->yaxis->title->Set("Moyennes");
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 12);
if ($codeperiode === "T") {
$graph->xaxis->SetTitle("Trimestres", "middle");
} else {
$graph->xaxis->SetTitle("Séquences", "middle");
}
$graph->SetBackgroundGradient('white', 'lightblue', GRAD_HOR, BGRAD_PLOT);
# Adjuster les margins (left, right, top, bottom)
$graph->SetMargin(40, 5, 21, 45);
# Box autour du plotarea
$graph->SetBox();
# Un cadre ou frame autour de l'image
$graph->SetFrame(false);
# Definir le titre tabulaire
$graph->tabtitle->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->tabtitle->Set($_SESSION['anneeacademique']);
# Definir le titre du graphe
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 8);
$graph->title->SetAlign("right");
if (count($ydata) > 1) {
$prev = $ydata[count($ydata) - 2];
if ($prev < $ydata[count($ydata) - 1]) {
$graph->title->Set("Performance en hausse");
} elseif ($prev == $ydata[count($ydata) - 1]) {
$graph->title->Set("Performance constante");
} else {
$graph->title->Set("Performance en baisse");
}
}
# Definir les grid X et Y
$graph->ygrid->SetFill(true, '#BBBBBB@0.9', '#FFFFFF@0.9');
//$graph->ygrid->SetLineStyle('dashed');
//$graph->ygrid->SetColor('gray');
//$graph->xgrid->SetLineStyle('dashed');
$graph->xgrid->SetColor('gray');
$graph->xgrid->Show();
//$graph->ygrid->Show();
#$graph->SetBackgroundGradient('blue','navy:0.5',GRAD_HOR,BGRAD_MARGIN);
$graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, 8);
$graph->xaxis->SetLabelAngle(0);
# Creation d'une bar pot
$bplot = new BarPlot($ydata);
$bplot->SetWidth(0.9);
$fcol = '#440000';
$tcol = '#FF9090';
$bplot->SetFillGradient($fcol, $tcol, GRAD_LEFT_REFLECTION);
# Set line weigth to 0 so that there are no border around each bar
$bplot->SetWeight(0);
# Create filled line plot
$lplot = new LinePlot($ydata2);
$lplot->SetFillColor('skyblue@0.5');
$lplot->SetStyle(1);
$lplot->SetColor('navy@0.7');
$lplot->SetBarCenter();
$lplot->mark->SetType(MARK_SQUARE);
$lplot->mark->SetColor('blue@0.5');
$lplot->mark->SetFillColor('lightblue');
$lplot->mark->SetSize(5);
# Afficher les moyenne au dessus des barres
$accbarplot = new AccBarPlot(array($bplot));
$accbarplot->value->SetFormat("%.2f");
$accbarplot->value->Show();
$graph->Add($accbarplot);
$graph->SetBackgroundImageMix(50);
# Definir un fond d'ecran pour l'image
$background = SITE_ROOT . "public/photos/eleves/" . $rang['PHOTOEL'];
if (!empty($rang['PHOTOEL']) && file_exists(ROOT . DS . "public" . DS . "photos" . DS . "eleves" . DS . $rang['PHOTOEL'])) {
$graph->SetBackgroundImage($background, BGIMG_FILLPLOT);
# $icon = new IconPlot($background, 25, 25, 0.8, 50);
//.........这里部分代码省略.........
示例13: date
// Balken- und Liniendiagramme hinzufügen
$graph->Add($gbplot);
$graph->Add($lplot_neu);
$graph->Add($lplot_alt);
// Überschrift und Achsenbeschriftung definieren
$graph->title->Set('Flugstunden und -bewegung(en) im Segelflug');
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 11);
$graph->xaxis->SetTickLabels($flugzeuge);
$graph->xaxis->SetFont(FF_VERDANA, FS_NORMAL, 10);
$bplot_neu->SetWeight(0);
$bplot_neu->SetFillColor('#61a9f3');
$bplot_neu->SetFillGradient('#61a9f3', '#c0c0ff', GRAD_HOR);
$bplot_neu->SetLegend(sprintf('Flugstunden %d', date('Y')));
$bplot_alt->SetWeight(0);
$bplot_alt->SetFillColor('orange');
$bplot_alt->SetFillGradient('orange', '#ffff00', GRAD_HOR);
$bplot_alt->SetLegend(sprintf('Flugstunden %d', date('Y') - 1));
// Liniendiagramm definieren für Anzahl der Landungen im aktuellen Jahr
$lplot_neu->SetBarCenter();
$lplot_neu->SetWeight(2);
$lplot_neu->SetColor('#0000ff');
$lplot_neu->SetLegend(sprintf('Flugbewegung(en) %d', date('Y')));
$lplot_neu->mark->SetType(MARK_UTRIANGLE, '', 1.0);
$lplot_neu->mark->SetWeight(2);
$lplot_neu->mark->SetWidth(8);
$lplot_neu->mark->setColor('#0000ff');
$lplot_neu->mark->setFillColor('#0000ff');
// Liniendiagramm definieren für Anzahl der Landungen im Vorjahr
$lplot_alt->SetBarCenter();
$lplot_alt->SetWeight(2);
$lplot_alt->SetColor('#ff0000');
示例14: ShowHBar
/**
* Show Horizontal Bar graph
*/
function ShowHBar(&$legend, &$value)
{
$height = 50 + count($value) * 18;
$width = 500;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale("textlin");
$top = 30;
$bottom = 20;
$left = 100;
$right = 50;
$graph->Set90AndMargin($left, $right, $top, $bottom);
$graph->xaxis->SetTickLabels($legend);
$graph->SetFrame(false);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('right', 'center', 'right');
// Label align for Y-axis
$graph->yaxis->SetLabelAlign('center', 'bottom');
// Create a bar pot
$bplot = new BarPlot($value);
$bplot->SetFillColor("orange");
$bplot->SetWidth(0.5);
// We want to display the value of each bar at the top
$graph->yaxis->scale->SetGrace(10);
$graph->yaxis->SetLabelAlign('center', 'bottom');
$graph->yaxis->SetLabelFormat('%d');
$bplot->value->Show();
$bplot->value->SetFormat('%.d votes');
// Setup color for gradient fill style
$bplot->SetFillGradient("navy", "lightsteelblue", GRAD_MIDVER);
$graph->Add($bplot);
$graph->Stroke();
}
示例15: hexdec
$color2 = '';
for ($x = 1; $x < 6; $x += 2) {
$dec = hexdec($color[$x] . $color[$x + 1]);
if ($dec + $degree < 256) {
if ($dec + $degree > -1) {
$dec += $degree;
} else {
$dec = 0;
}
} else {
$dec = 255;
}
$color2 .= dechex($dec);
}
$color2 = "#{$color2}";
$plot->SetFillGradient($color, $color2, $options['graph_gradient']);
}
if (!empty($options['graph_show_values'])) {
if (!isset($plot->value) || !method_exists($plot->value, 'show')) {
mydie("This JPGraph version does not support 'Show values'");
}
$plot->value->Show();
}
if ($options['graph_plotshadow']) {
$plot->SetShadow();
}
$graph->Add($plot);
$graph->xaxis->SetTickLabels($data['legend']);
//$graph->yaxis->scale->SetGrace(5); //show 5% more values than max
//$graph->xaxis->SetLabelAngle(40); // only with TTF fonts
//$graph->title->Set($title);