本文整理汇总了PHP中Graph::SetMarginColor方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::SetMarginColor方法的具体用法?PHP Graph::SetMarginColor怎么用?PHP Graph::SetMarginColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::SetMarginColor方法的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: execute
function execute()
{
$this->set_title('Statistics Center');
$this->tree('Statistics Center');
if (!extension_loaded('gd')) {
return $this->message('JpGraph Error', 'You need to install the correct GD libraries to run the Statistics centre (GD Libraries were not detected)');
}
include '../lib/jpgraph/jpgraph.php';
include '../lib/jpgraph/jpgraph_bar.php';
if (!defined('IMG_PNG')) {
return $this->message('JpGraph Error', 'This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)');
}
/**
* Posts
*/
$query = $this->db->query("\r\n\t\tSELECT\r\n\t\t COUNT(post_id) AS posts,\r\n\t\t FROM_UNIXTIME(post_time, '%b %y') AS month\r\n\t\tFROM {$this->pre}posts\r\n\t\tGROUP BY month\r\n\t\tORDER BY post_time");
$data = array();
while ($item = $this->db->nqfetch($query)) {
$data[$item['month']] = $item['posts'];
}
if (!$data) {
$data = array(0, 0);
}
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textint');
$graph->SetColor('aliceblue');
$graph->SetMarginColor('white');
$graph->xaxis->SetTickLabels(array_keys($data));
$graph->yaxis->scale->SetGrace(20);
$graph->title->Set('Posts by Month');
$temp = array_values($data);
$barplot = new BarPlot($temp);
$barplot->SetFillColor('darkorange');
$graph->add($barplot);
$graph->Stroke("{$this->time}1.png");
/**
* Registrations
*/
$query = $this->db->query("\r\n\t\tSELECT\r\n\t\t COUNT(user_id) AS users,\r\n\t\t FROM_UNIXTIME(user_joined, '%b %y') AS month\r\n\t\tFROM {$this->pre}users\r\n\t\tWHERE user_joined != 0\r\n\t\tGROUP BY month\r\n\t\tORDER BY user_joined");
$data = array();
while ($item = $this->db->nqfetch($query)) {
$data[$item['month']] = $item['users'];
}
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textint');
$graph->SetColor('aliceblue');
$graph->SetMarginColor('white');
$graph->xaxis->SetTickLabels(array_keys($data));
$graph->yaxis->scale->SetGrace(20);
$graph->title->Set('Registrations by Month');
$temp = array_values($data);
$barplot = new BarPlot($temp);
$barplot->SetFillColor('darkorange');
$graph->add($barplot);
$graph->Stroke("{$this->time}2.png");
return $this->message('Statistics Center', "<img src='{$this->time}1.png' alt='Posts by Month' /><br /><br />\r\n\t\t<img src='{$this->time}2.png' alt='Registrations by Month' />");
}
示例3: execute
function execute()
{
$this->set_title($this->lang->stats);
$this->tree($this->lang->stats);
include '../lib/jpgraph/jpgraph.php';
include '../lib/jpgraph/jpgraph_bar.php';
if (!defined('IMG_PNG')) {
JpGraphError::Raise("This PHP installation is not configured with PNG support. Please recompile PHP with GD and JPEG support to run JpGraph. (Constant IMG_PNG does not exist)");
}
/**
* Posts
*/
$query = $this->db->query("SELECT COUNT(post_id) AS posts, FROM_UNIXTIME(post_time, '%%b %%y') AS month\n\t\t\tFROM %pposts GROUP BY month\tORDER BY post_time");
$data = array();
while ($item = $this->db->nqfetch($query)) {
$data[$item['month']] = $item['posts'];
}
if (!$data) {
$data = array(0, 0);
}
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textint');
$graph->SetColor('aliceblue');
$graph->SetMarginColor('white');
$graph->xaxis->SetTickLabels(array_keys($data));
$graph->yaxis->scale->SetGrace(20);
$graph->title->Set($this->lang->stats_post_by_month);
$temp = array_values($data);
$barplot = new BarPlot($temp);
$barplot->SetFillColor('darkorange');
$graph->add($barplot);
$graph->Stroke("../stats/{$this->time}1.png");
/**
* Registrations
*/
$query = $this->db->query("SELECT COUNT(user_id) AS users, FROM_UNIXTIME(user_joined, '%%b %%y') AS month\n\t\t\tFROM %pusers\n\t\t\tWHERE user_joined != 0\n\t\t\tGROUP BY month\n\t\t\tORDER BY user_joined");
$data = array();
while ($item = $this->db->nqfetch($query)) {
$data[$item['month']] = $item['users'];
}
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textint');
$graph->SetColor('aliceblue');
$graph->SetMarginColor('white');
$graph->xaxis->SetTickLabels(array_keys($data));
$graph->yaxis->scale->SetGrace(20);
$graph->title->Set($this->lang->stats_reg_by_month);
$temp = array_values($data);
$barplot = new BarPlot($temp);
$barplot->SetFillColor('darkorange');
$graph->add($barplot);
$graph->Stroke("../stats/{$this->time}2.png");
return $this->message($this->lang->stats, "<img src='../stats/{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='../stats/{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
}
示例4: 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();
}
示例5: summary
/**
*
*/
public function summary($id)
{
$iterationAux;
//try {
$project = Project::findOrFail($id);
$iterations = Iterations::where('projectid', '=', $id)->get();
//foreach($iterations as $var){
// $iterationAux = $iterationAux . var_dump($var);
//}
//}catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
//}
//die;
JpGraph\JpGraph::load();
JpGraph\JpGraph::module('bar');
JpGraph\JpGraph::module('line');
$datay = array(20, 30, 50, 80);
$datay2 = array(30, 95, 70, 40);
$datazero = array(0, 0, 0, 0);
// Create the graph.
$graph = new Graph(800, 500);
$graph->title->Set('Example with 2 scale bars : ' . $project->name . ' : ' . $id . ' : ' . sizeof($iterations));
// Setup Y and Y2 scales with some "grace"
$graph->SetScale("textlin");
$graph->SetY2Scale("lin");
//$graph->yaxis->scale->SetGrace(30);
//$graph->y2axis->scale->SetGrace(30);
//$graph->ygrid->Show(true,true);
$graph->ygrid->SetColor('gray', 'lightgray@0.5');
// Setup graph colors
$graph->SetMarginColor('white');
$graph->y2axis->SetColor('darkred');
// Create the "dummy" 0 bplot
$bplotzero = new BarPlot($datazero);
// Create the "Y" axis group
$ybplot1 = new BarPlot($datay);
$ybplot1->value->Show();
$ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
// Create the "Y2" axis group
$ybplot2 = new BarPlot($datay2);
$ybplot2->value->Show();
$ybplot2->value->SetColor('darkred');
$ybplot2->SetFillColor('darkred');
$y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
// Add the grouped bar plots to the graph
$graph->Add($ybplot);
$graph->AddY2($y2bplot);
$datax = array('A', 'B', 'C', 'D');
$graph->xaxis->SetTickLabels($datax);
// .. and finally stroke the image back to browser
$graph->Stroke();
}
示例6: execute
function execute()
{
$this->set_title($this->lang->stats);
$this->tree($this->lang->stats);
include '../lib/jpgraph/jpgraph.php';
include '../lib/jpgraph/jpgraph_bar.php';
/**
* Posts
*/
$query = $this->db->query("\n\t\tSELECT\n\t\t COUNT(post_id) AS posts,\n\t\t FROM_UNIXTIME(post_time, '%b %y') AS month\n\t\tFROM {$this->pre}posts\n\t\tGROUP BY month\n\t\tORDER BY post_time");
$data = array();
while ($item = $this->db->nqfetch($query)) {
$data[$item['month']] = $item['posts'];
}
if (!$data) {
$data = array(0, 0);
}
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textint');
$graph->SetColor('aliceblue');
$graph->SetMarginColor('white');
$graph->xaxis->SetTickLabels(array_keys($data));
$graph->yaxis->scale->SetGrace(20);
$graph->title->Set($this->lang->stats_post_by_month);
$barplot = new BarPlot(array_values($data));
$barplot->SetFillColor('darkorange');
$graph->add($barplot);
$graph->Stroke("{$this->time}1.png");
/**
* Registrations
*/
$query = $this->db->query("\n\t\tSELECT\n\t\t COUNT(user_id) AS users,\n\t\t FROM_UNIXTIME(user_joined, '%b %y') AS month\n\t\tFROM {$this->pre}users\n\t\tWHERE user_joined != 0\n\t\tGROUP BY month\n\t\tORDER BY user_joined");
$data = array();
while ($item = $this->db->nqfetch($query)) {
$data[$item['month']] = $item['users'];
}
$graph = new Graph(400, 300, 'auto');
$graph->SetScale('textint');
$graph->SetColor('aliceblue');
$graph->SetMarginColor('white');
$graph->xaxis->SetTickLabels(array_keys($data));
$graph->yaxis->scale->SetGrace(20);
$graph->title->Set($this->lang->stats_reg_by_month);
$barplot = new BarPlot(array_values($data));
$barplot->SetFillColor('darkorange');
$graph->add($barplot);
$graph->Stroke("{$this->time}2.png");
return $this->message($this->lang->stats, "<img src='{$this->time}1.png' alt='{$this->lang->stats_post_by_month}' /><br /><br />\n\t\t<img src='{$this->time}2.png' alt='{$this->lang->stats_reg_by_month}' />");
}
示例7: LineGraph
function LineGraph($w, $h, $title, $data1, $data2, $datax, $output)
{
// Create the graph. These two calls are always required
$graph = new Graph($w, $h, "auto");
$graph->SetScale("textlin");
$graph->SetMarginColor('white');
$graph->SetFrame(true);
// Adjust the margin
$graph->img->SetMargin(40, 100, 20, 40);
$graph->SetShadow(false);
// Create the linear plot
$lineplot = new LinePlot($data1);
$lineplot->SetWeight(2);
$lineplot->SetColor("blue");
$lineplot->mark->SetType(MARK_DIAMOND);
$lineplot->mark->SetWidth(5);
$lineplot->mark->SetFillColor('blue');
$lineplot->value->SetMargin(-20);
$lineplot->value->show();
$lineplot->value->SetColor('blue');
$lineplot->value->SetFormat('%0.0f');
$lineplot->SetLegend($_SESSION[Tahun1]);
$lineplot2 = new LinePlot($data2);
$lineplot2->SetColor("green");
$lineplot2->SetWeight(2);
$lineplot2->mark->SetType(MARK_FILLEDCIRCLE);
$lineplot2->mark->SetWidth(3);
$lineplot2->mark->SetFillColor('green');
$lineplot2->value->show();
$lineplot2->value->SetColor('darkgreen');
$lineplot2->value->SetFormat('%0.0f');
$lineplot2->SetLegend($_SESSION[Tahun2]);
// Add the plot to the graph
$graph->Add($lineplot);
$graph->xaxis->SetTickLabels($datax);
$graph->title->Set($title);
$graph->xaxis->title->Set("");
$graph->yaxis->title->Set("");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->Add($lineplot2);
$graph->legend->SetShadow(false);
$graph->legend->SetFillColor('white');
$graph->legend->SetPos(0.01, 0.88, 'right', 'center');
// Display the graph
$graph->Stroke($output);
}
示例8: createSpline
function createSpline($ydata = "")
{
$xdata = array(2, 4, 6, 8, 10, 12, 14, 16);
if (!$ydata) {
$ydata = array(5, 1, 9, 6, 4, 3, 4, 2);
}
// Get the interpolated values by creating
// a new Spline object.
$spline = new Spline($xdata, $ydata);
// For the new data set we want 40 points to
// get a smooth curve.
list($newx, $newy) = $spline->Get(50);
// Create the graph
$g = new Graph(380, 300);
$g->SetMargin(30, 20, 40, 30);
//$g->title->Set("Natural cubic splines");
//$g->title->SetFont(FF_ARIAL,FS_NORMAL,12);
//$g->subtitle->Set('(Control points shown in red)');
//$g->subtitle->SetColor('darkred');
$g->SetMarginColor('lightblue');
//$g->img->SetAntiAliasing();
// We need a linlin scale since we provide both
// x and y coordinates for the data points.
$g->SetScale('linlin');
$xlable = array('', 'AA', 'AA', 'AB', 'AB', 'BB', 'BB', 'BC', 'BC', 'CC', 'CC', 'CD', 'CD', 'DD', 'DD', 'FF', 'FF', '');
// We want 1 decimal for the X-label
//$g -> xaxis -> SetLabelFormat('%d');
$g->xaxis->SetTickLabels($xlable);
// We use a scatterplot to illustrate the original
// contro points.
$splot = new ScatterPlot($ydata, $xdata);
//
$splot->mark->SetFillColor('red@0.3');
$splot->mark->SetColor('red@0.5');
// And a line plot to stroke the smooth curve we got
// from the original control points
$lplot = new LinePlot($newy, $newx);
$lplot->SetColor('navy');
// Add the plots to the graph and stroke
$g->Add($lplot);
$g->Add($splot);
$g->Stroke();
}
示例9: generateGraph
function generateGraph()
{
if ($this->getVar('hasGraph') == 0) {
return false;
}
if ($this->getVar('hasResults') == 0) {
$this->_setResults();
}
$aResults = $this->getVar('results');
$graph = new Graph(500, 300);
$graph->title->Set($this->meta['name']);
$graph->SetScale("textint");
$graph->yaxis->scale->SetGrace(30);
//$graph->ygrid->Show(true,true);
$graph->ygrid->SetColor('gray', 'lightgray@0.5');
// Setup graph colors
$graph->SetMarginColor('white');
$i = 0;
$data = array();
foreach ($aResults as $result) {
$data[0][] = $result['name'];
$data[1][] = $result['ticketsResponded'];
$data[2][] = $result['callsClosed'];
$data[3][] = $result['avgResponseTime'];
}
$datazero = array(0, 0, 0, 0);
// Create the "dummy" 0 bplot
$bplotzero = new BarPlot($datazero);
// Set names as x-axis label
$graph->xaxis->SetTickLabels($data[0]);
// Create the "Y" axis group
foreach ($data as $d) {
$ybplot1 = new BarPlot($d);
$ybplot1->value->Show();
$ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
$graph->Add($ybplot);
}
// Set graph background image
$graph->SetBackgroundImage(XHELP_IMAGE_PATH . '/graph_bg.jpg', BGIMG_FILLFRAME);
$graph->Stroke();
}
示例10: 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;
}
示例11: array
<?php
// content="text/plain; charset=utf-8"
// Example for use of JpGraph,
// ljp, 01/03/01 20:32
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_bar.php';
// We need some data
$datay = array(-0.13, 0.25, -0.21, 0.35, 0.31, 0.04);
$datax = array("Jan", "Feb", "Mar", "Apr", "May", "June");
// 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
示例12: array
<?php
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
$datay = array(20, 10, 35, 5, 17, 35, 22);
// Setup the graph
$graph = new Graph(400, 200);
$graph->SetMargin(40, 40, 20, 30);
$graph->SetScale("intlin");
$graph->SetBox();
$graph->SetMarginColor('darkgreen@0.8');
// Setup a background gradient image
$graph->SetBackgroundGradient('darkred', 'yellow', GRAD_HOR, BGRAD_PLOT);
$graph->title->Set('Gradient filled line plot ex2');
$graph->yscale->SetAutoMin(0);
// Create the line
$p1 = new LinePlot($datay);
$p1->SetFillGradient('white', 'darkgreen');
$p1->SetStepStyle();
$graph->Add($p1);
// Output line
$graph->Stroke();
?>
示例13: array
//Giving the colors to the Line graph
$color_array = array("red", "blue", "orange", "green", "darkorchid", "gold1", "gray3", "lightpink", "burlywood2", "cadetblue");
$datavalue = isset($_REQUEST['datavalue']) ? $_REQUEST['datavalue'] : "0,K,0";
//Exploding the Ticket status
$datavalue = explode("K", $datavalue);
$width = isset($_REQUEST['width']) ? $_REQUEST['width'] : 410;
$height = isset($_REQUEST['height']) ? $_REQUEST['height'] : 270;
$left = isset($_REQUEST['left']) ? $_REQUEST['left'] : 50;
$right = isset($_REQUEST['right']) ? $_REQUEST['right'] : 130;
$top = isset($_REQUEST['top']) ? $_REQUEST['top'] : 50;
$bottom = isset($_REQUEST['bottom']) ? $_REQUEST['bottom'] : 60;
$title = isset($_REQUEST['title']) ? $_REQUEST['title'] : "Horizontal graph";
$target_val = isset($_REQUEST['target_val']) ? $_REQUEST['target_val'] : "";
// Setup the graph
$graph = new Graph($width, $height);
$graph->SetMarginColor('white');
$graph->SetScale("textlin");
$graph->SetMargin($left, $right, $top, $bottom);
$graph->tabtitle->Set($title);
$graph->tabtitle->SetFont(FF_FONT2, FS_BOLD, 13);
$graph->yaxis->HideZeroLabel();
$graph->xgrid->Show();
$thick = 6;
// Create the lines of the Graph
for ($i = 0; $i < count($datavalue); $i++) {
$data = $datavalue[$i];
$graph_data = explode(",", $data);
$name = $name_value[$i];
$color_val = $color_array[$i];
$temp = "p" . $i;
${$temp} = new LinePlot($graph_data);
示例14: 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();
}
示例15: Graph
$crmin = $crmin + 6;
if ($crmin >= 60) {
$crhour = $crhour + 1;
if ($crhour > 23) {
$crhour = 0;
}
$crmin = $crmin - 60;
}
$x[$i] = str_pad($crhour, 2, $hr_pad, STR_PAD_LEFT) . ":" . str_pad($crmin, 2, "0", STR_PAD_LEFT);
}
$datax = $x;
// Create the graph. These two calls are always required
$graph = new Graph($xsize, $ysize, "auto", 30);
$graph->SetScale("textlin");
$graph->yaxis->scale->SetGrace(10);
$graph->SetMarginColor("{$margincolour}");
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->SetMargin($lm, $rm, $tm, $bm);
// Create a line plot
$lplot = new LinePlot($datay);
$lplot->SetWeight(2);
$lplot->SetColor("{$speed_col}");
$graph->Add($lplot);
// titles
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->Set("{$txt_wind_sp} {$txt_60m} ({$speed_unit})");
$graph->title->SetColor("{$textcolour}");
//x-axis
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 8);