本文整理汇总了PHP中Graph::SetColor方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::SetColor方法的具体用法?PHP Graph::SetColor怎么用?PHP Graph::SetColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::SetColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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' />");
}
示例2: 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}' />");
}
示例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';
/**
* 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}' />");
}
示例4: plot
function plot()
{
$this->_setValues();
$graph = new Graph(380, 250);
$graph->img->SetMargin(50, 30, 40, 40);
$graph->SetShadow();
$graph->SetColor("lightyellow");
$graph->SetScale("textlin");
$graph->title->Set($this->_graphTitle);
$graph->yaxis->SetColor("blue");
$graph->xaxis->SetColor("blue");
$graph->title->SetFont(FONT1_BOLD);
$graph->xaxis->SetTickLabels($this->_xaxisValues);
$lineplot = new LinePlot($this->_yaxisValues);
$lineplot->SetColor("red");
// Add the plot to the graph
$graph->Add($lineplot);
// Display the graph
$graph->Stroke();
}
示例5: 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;
}
示例6: count
for ($i = 0; $i < $n; ++$i) {
$y2data[] = $ydata[$i] + 10;
}
// Negate all data
$n = count($ydata);
for ($i = 0; $i < $n; ++$i) {
$ydata[$i] = round(-$ydata[$i]);
$y2data[$i] = round(-$y2data[$i]);
}
// Basic graph setup
$graph = new Graph(400, 300);
$graph->SetScale("linlin");
$graph->SetY2Scale("lin");
$graph->SetMargin(50, 50, 60, 40);
$graph->SetMarginColor('darkblue');
$graph->SetColor('darkblue');
// Setup titles
$graph->title->Set("Inverting both Y-axis");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->title->SetColor("white");
$graph->subtitle->Set("(Negated Y & Y2 axis)");
$graph->subtitle->SetFont(FF_FONT1, FS_NORMAL);
$graph->subtitle->SetColor("white");
// Setup axis
$graph->yaxis->SetLabelFormatCallback("_cb_negate");
$graph->xaxis->SetColor("lightblue", "white");
$graph->yaxis->SetColor("lightblue", "white");
$graph->ygrid->SetColor("blue");
// Setup Y2 axis
$graph->y2axis->SetLabelFormatCallback("_cb_negate");
$graph->y2axis->SetColor("darkred", "white");
示例7: list
$timeline .= "bis {$day}.{$month}.{$year} ";
} else {
list($month, $year) = split('[/]', $thestart);
$thestart = "{$year}-{$month}-01 00:00:00";
$timeline = "vom 1.{$month}.{$year} ";
list($month, $year) = split('[/]', $theend);
$theend = "{$year}-{$month}-01 00:00:00";
$data = $statistics->get($thestart, $theend, $thecat3, $from_clock3, $till_clock3);
$timeline .= "bis 1.{$month}.{$year} ";
}
for ($i = 0; $i < count($data); $i++) {
$labels[$i] = $data[$i]['description'];
$gdata[$i] = $data[$i]['num'];
}
$graph = new Graph(700, 500, "auto");
$graph->SetColor("white");
$graph->SetFrame(false);
$graph->SetScale("textlin");
$graph->title->Set("Verkaufte Artikel {$timeline}");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->title->Set("Artikel");
$graph->yaxis->title->Set("Stückzahl");
$graph->yaxis->SetTitleMargin(45);
$graph->xaxis->SetTickLabels($labels);
$graph->img->SetMargin(60, 40, 40, 150);
$barplot = new BarPlot($gdata);
$barplot->SetColor(array("red", "green", "blue", "gray", "yellow"));
$barplot->SetFillColor(array("red", "green", "blue", "gray", "yellow"));
示例8: FuncGenerator
<?php
include "../jpgraph.php";
include "../jpgraph_line.php";
$f = new FuncGenerator('cos($i)', '$i*$i*$i');
list($xdata, $ydata) = $f->E(-M_PI, M_PI, 25);
$graph = new Graph(350, 430, "auto");
$graph->SetScale("linlin");
$graph->SetShadow();
$graph->img->SetMargin(50, 50, 60, 40);
$graph->SetBox(true, 'black', 2);
$graph->SetMarginColor('white');
$graph->SetColor('lightyellow');
$graph->SetAxisStyle(AXSTYLE_BOXIN);
$graph->xgrid->Show();
//$graph->xaxis->SetLabelFormat('%.0f');
$graph->img->SetMargin(50, 50, 60, 40);
$graph->title->Set("Function plot");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->subtitle->Set("(BOXIN Axis style)");
$graph->subtitle->SetFont(FF_FONT1, FS_NORMAL);
$lp1 = new LinePlot($ydata, $xdata);
$lp1->SetColor("blue");
$lp1->SetWeight(2);
$graph->Add($lp1);
$graph->Stroke();
?>
示例9: array
<?php
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_bar.php';
// Some data
$datay = array(7, 19, 11, 4, 20);
// Create the graph and setup the basic parameters
$graph = new Graph(300, 200, 'auto');
$graph->img->SetMargin(40, 30, 40, 50);
$graph->SetScale("textint");
$graph->SetFrame(true, 'blue', 1);
$graph->SetColor('lightblue');
$graph->SetMarginColor('lightblue');
// Setup X-axis labels
$a = $gDateLocale->GetShortMonth();
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetFont(FF_FONT1);
$graph->xaxis->SetColor('darkblue', 'black');
// Setup "hidden" y-axis by given it the same color
// as the background (this could also be done by setting the weight
// to zero)
$graph->yaxis->SetColor('lightblue', 'darkblue');
$graph->ygrid->SetColor('white');
// Setup graph title ands fonts
$graph->title->Set('Using grace = 50%');
$graph->title->SetFont(FF_FONT2, FS_BOLD);
$graph->xaxis->SetTitle('Year 2002', 'center');
$graph->xaxis->SetTitleMargin(10);
$graph->xaxis->title->SetFont(FF_FONT2, FS_BOLD);
// Add some grace to the top so that the scale doesn't
示例10: array
<?php
include "../jpgraph.php";
include "../jpgraph_bar.php";
//include ("../jpgraph_flags.php");
// Some data
$datay1 = array(140, 110, 50);
$datay2 = array(35, 90, 190);
$datay3 = array(20, 60, 70);
// Create the basic graph
$graph = new Graph(300, 200);
$graph->SetScale("textlin");
$graph->SetMargin(40, 20, 20, 40);
$graph->SetMarginColor('white:0.9');
$graph->SetColor('white');
$graph->SetShadow();
// Adjust the position of the legend box
$graph->legend->Pos(0.03, 0.1);
// Adjust the color for theshadow of the legend
$graph->legend->SetShadow('darkgray@0.5');
$graph->legend->SetFillColor('lightblue@0.1');
$graph->legend->Hide();
// Get localised version of the month names
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
//$graph->SetBackgroundCountryFlag('mais',BGIMG_COPY,50);
// Set axis titles and fonts
$graph->xaxis->title->Set('Year 2002');
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetColor('white');
$graph->xaxis->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetColor('navy');
示例11: Graph
$mph[] = $thisMPH;
$alti[] = $thisALTI;
}
$lts = $timestamp;
}
// End of while
include "../../../include/jpgraph/jpgraph.php";
include "../../../include/jpgraph/jpgraph_line.php";
include "../../../include/jpgraph/jpgraph_date.php";
include "../../../include/jpgraph/jpgraph_scatter.php";
// Create the graph. These two calls are always required
$graph = new Graph(640, 480);
$graph->SetScale('datlin', 0, 360);
$graph->SetYScale(0, 'lin', 0, 60);
$graph->SetYScale(1, 'lin');
$graph->SetColor("#f0f0f0");
$graph->img->SetMargin(55, 110, 55, 60);
$graph->title->Set("Polk City, Iowa SchoolNet Sub 1 Minute Time Series");
$graph->title->SetFont(FF_FONT1, FS_BOLD, 20);
$graph->xaxis->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetTitle("Times on the morning of 2 Oct 2007");
$graph->xaxis->SetTitleMargin(27);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD, 12);
$graph->xaxis->SetPos("min");
$graph->xaxis->SetLabelFormatString("h:i", true);
$graph->xaxis->scale->SetTimeAlign(MINADJ_1);
$graph->xaxis->SetLabelAngle(90);
$graph->yaxis->SetFont(FF_FONT1, FS_BOLD, 14);
$graph->yaxis->scale->ticks->Set(45, 15);
$graph->yaxis->SetTitle("Wind Direction (blue dots)");
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD, 12);
示例12: explode
$data = $datavalue[$i];
$target = $target_val[$i];
$graph_data = explode(",", $data);
$data[$i] = $data;
$bplot[$i] = new BarPlot($graph_data);
$bplot[$i]->SetFillColor($color_array[$i]);
$bplot[$i]->SetWidth(10);
$bplot[$i]->value->Show();
$bplot[$i]->value->SetFont(FF_FONT1, FS_NORMAL, 8);
$bplot[$i]->value->SetColor("black");
$bplot[$i]->value->SetFormat('%d');
$bplot[$i]->SetValuePos('max');
}
$gbplot = new AccBarPlot($bplot);
$gbplot->SetWidth(0.7);
// Add the bar to the graph
$graph->Add($gbplot);
$graph->xaxis->SetTickLabels($datax);
$graph->title->Set($title);
$graph->Set90AndMargin($left, $right, $top, $bottom);
//$graph->SetFrame(false);
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->SetColor("#7D9CB8");
$graph->SetMarginColor("#3D6A93");
// Display the graph
$graph->Stroke();
?>
示例13: pow
require_once 'jpgraph/jpgraph_log.php';
// Matrix size rxr
$r = 10;
// Max Interpolation factor
$f = 5;
for ($i = 1; $i <= $f; ++$i) {
$xdata[] = $i;
$ydata[] = pow($r * pow(2, $i - 1) - (pow(2, $i) - 1), 2);
}
$graph = new Graph(400, 240);
$graph->SetScale('intlog');
$graph->SetMargin(50, 50, 20, 30);
$graph->SetFrame(false);
$graph->SetBox(true, 'black', 2);
$graph->SetMarginColor('white');
$graph->SetColor('lightyellow@0.7');
$graph->title->Set('Interpolation growth for size 10x10');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetTitle('Interpolation factor', 'center');
$graph->xaxis->SetTitleMargin(10);
$graph->SetAxisStyle(AXSTYLE_YBOXIN);
$graph->xgrid->Show();
$lp1 = new LinePlot($ydata, $xdata);
$lp1->SetColor('darkred');
$lp1->SetWeight(3);
$graph->Add($lp1);
$graph->Stroke();
?>
示例14: Graph
$data_closed_count_arr[] = get_closed_count_by_date($val);
}
foreach ($data_date_arr as $key => $val) {
$data_date_arr[$key] = $val . ' ';
}
$proj_name = project_get_field($t_project_id, 'name');
# Setup Graph
# ---
$graph = new Graph(800, 600, "auto");
$graph->img->SetMargin(40, 20, 40, 90);
if (ON == config_get_global('jpgraph_antialias')) {
$graph->img->SetAntiAliasing("white");
}
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->SetColor('whitesmoke');
$graph->title->Set("Cumulative - New, Resolved and Closed: {$proj_name}");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->SetFont(FF_FONT1, FS_NORMAL, 5);
$graph->xaxis->SetTickLabels($data_date_arr);
$graph->xaxis->SetLabelAngle(90);
$graph->legend->Pos(0.75, 0.2);
# OPEN
$p1 = new LinePlot($data_open_count_arr);
$p1->mark->SetType(MARK_FILLEDCIRCLE);
$p1->mark->SetFillColor("blue");
$p1->mark->SetWidth(3);
$p1->SetColor("blue");
$p1->SetCenter();
$p1->SetLegend("Total");
$graph->Add($p1);
示例15: FuncGenerator
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_line.php';
require_once 'jpgraph/jpgraph_utils.inc.php';
$f = new FuncGenerator('cos($x)*$x');
list($xdata, $ydata) = $f->E(-1.2 * M_PI, 1.2 * M_PI);
$f = new FuncGenerator('$x*$x');
list($x2data, $y2data) = $f->E(-2, 2);
// Setup the basic graph
$graph = new Graph(450, 350);
$graph->SetScale("linlin");
//$graph->SetShadow();
$graph->img->SetMargin(5, 10, 60, 9);
$graph->SetBox(true, 'green', 2);
$graph->SetMarginColor('black');
$graph->SetColor('black');
// ... and titles
$graph->title->Set('Example of Function plot');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->title->SetColor('lightgreen');
$graph->subtitle->Set("(With some more advanced axis formatting\nHiding first and last label)");
$graph->subtitle->SetFont(FF_FONT1, FS_NORMAL);
$graph->subtitle->SetColor('lightgreen');
$graph->xgrid->Show();
$graph->xgrid->SetColor('darkgreen');
$graph->ygrid->SetColor('darkgreen');
$graph->yaxis->SetPos(0);
$graph->yaxis->SetWeight(2);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->SetColor('green', 'green');