本文整理汇总了PHP中Graph::Stroke方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::Stroke方法的具体用法?PHP Graph::Stroke怎么用?PHP Graph::Stroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::Stroke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Genera la imagen
* @param string $path path completo de la imagen a generar
*/
function imagen__generar($path)
{
if (!isset($this->canvas)) {
throw new toba_error("Generación de imágen: No hay ningún canvas seteado");
}
// escribimos la imagen a un archivo
$this->canvas->Stroke($path);
}
示例2: graphs
static function graphs($name, $close)
{
// Setup the graph
$graph = new Graph(1000, 653, 'auto');
$graph->SetScale("textlin");
$theme_class = new UniversalTheme();
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->SetFont(FF_FONT2, FS_BOLD, 20);
$graph->title->Set("Stock Performance History for " . $name);
$graph->SetBox(false);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
$graph->yaxis->title->SetFont(FF_FONT2, FS_BOLD, 20);
$graph->yaxis->title->Set('Close Price');
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickPositions(array(0, 20, 40, 61, 82, 103, 124, 143));
$graph->xaxis->SetTickLabels(array('Nov 2014', 'Dec 2014', 'Jan 2015', 'Feb 2015', 'March 2015', 'April 2015', 'May 2015', 'June 2015'));
$graph->xaxis->title->SetFont(FF_FONT2, FS_BOLD, 20);
$graph->xaxis->title->Set('Dates');
$graph->xgrid->SetColor('#E3E3E3');
// Create the first line
$p1 = new LinePlot($close);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$graph->legend->SetFrameWeight(2);
// Output line
$graph->Stroke();
}
示例3: graficofecha
public function graficofecha($gestion)
{
if (Conectar::con()) {
//$gestion='2013';
$objetoanalisis = new classAnalisis();
$anio = $gestion;
for ($i = 0; $i < 12; $i++) {
$dat[] = $objetoanalisis->ventamensual($anio, $i);
}
$datos = $dat;
//$datos =array('1','4','3','3','5');
$grafico = new Graph(400, 300, "auto");
$grafico->SetScale("textlin");
$grafico->title->Set("Resumen de ventas por gestion");
$grafico->xaxis->title->Set("");
$grafico->yaxis->title->Set("");
// Un gradiente Horizontal de rojo a azul
// 25 pixeles de ancho para cada barra
$lineplot = new LinePlot($datos);
$lineplot->SetColor("green");
$lineplot->SetWeight(2);
$grafico->Add($lineplot);
return $grafico->Stroke();
}
}
示例4: build
public function build()
{
$path = APPPATH;
require_once $path . 'libraries/jpgraph/src/jpgraph.php';
require_once $path . 'libraries/jpgraph/src/jpgraph_bar.php';
// $datay = array(62, 105, 85, 50);
$datay = $this->parameters;
// Create the graph. These two calls are always required
// $graph = new Graph(350, 220, 'auto');
$graph = new Graph(350, 220, 'auto');
$graph->SetScale("textlin");
//$theme_class="DefaultTheme";
//$graph->SetTheme(new $theme_class());
// set major and minor tick positions manually
$graph->yaxis->SetTickPositions(array(0, 30, 60, 90, 120, 150), array(15, 45, 75, 105, 135));
$graph->SetBox(false);
//$graph->ygrid->SetColor('gray');
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('A', 'B', 'C', 'D'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
// Create the bar plots
// $b1plot = new BarPlot($datay);
$b1plot = new BarPlot($datay);
// ...and add it to the graPH
$graph->Add($b1plot);
$b1plot->SetColor("white");
$b1plot->SetFillGradient("#4B0082", "white", GRAD_LEFT_REFLECTION);
$b1plot->SetWidth(45);
$graph->title->Set("Bar Gradient(Left reflection)");
// Display the graph
$d['grafica'] = $graph->Stroke("jacobo.png");
$d['path'] = $path;
return $d;
}
示例5: plot
function plot($pid)
{
$this->_setValues($pid);
$graph = new Graph(600, 400);
$graph->img->SetMargin(60, 95, 40, 40);
$graph->SetShadow();
$graph->SetScale("textlog");
$colors = array("yellow", "green", "blue", "red");
srand(1);
for ($i = 0; $i < sizeof($this->_data); $i++) {
$bplot[$i] = new BarPlot($this->_data[$i]);
$color = $colors[$i];
$bplot[$i]->SetFillColor($color);
$bplot[$i]->SetLegend($this->_legend[$i]);
}
$gbplot = new GroupBarPlot($bplot);
$graph->Add($gbplot);
$graph->title->Set("# of Visited Articles per Language (log scale)");
$graph->title->SetFont(FONT2_BOLD);
$graph->xaxis->SetTickLabels($this->_years);
$graph->ygrid->Show(true, true);
$graph->xaxis->SetFont(FONT1_BOLD);
$graph->yaxis->SetFont(FONT1_BOLD);
$graph->Stroke();
}
示例6: showimg
function showimg($value, $clock, $key)
{
$datay1 = $value;
$graph = new Graph(1000, 400);
$graph->SetScale("textlin");
//设置图片外边距(左,右,上,下)
$graph->img->SetMargin(100, 20, 20, 60);
$graph->title->Set($key);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
//x轴文字
$graph->xaxis->SetTickLabels($clock);
$graph->xaxis->SetLabelAngle(90);
//x轴颜色
$graph->xgrid->SetColor('#E3E3E3');
// Create the first line
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$graph->legend->SetFrameWeight(1);
// Output line
$graph->Stroke();
}
示例7: plot
function plot($pid)
{
$this->_setValues($pid);
$graph = new Graph(600, 400);
$graph->img->SetMargin(60, 95, 40, 40);
$graph->SetShadow();
$graph->SetScale("textlog");
$colors = array("hotpink", "green", "blue", "gold", "blueviolet", "deepskyblue", "brown", "cadetblue", "darksalmon", "cornflowerblue", "darkslateblue", "limegreen", "yellow", "navy", "slategray");
srand(1);
for ($i = 0; $i < sizeof($this->_data); $i++) {
$bplot[$i] = new BarPlot($this->_data[$i]);
if ($i < sizeof($colors)) {
$color = $colors[$i];
} else {
$r = rand(0, 255);
$g = rand(0, 255);
$b = rand(0, 255);
$color = array($r, $g, $b);
}
$bplot[$i]->SetFillColor($color);
$bplot[$i]->SetLegend($this->_legend[$i]);
}
$gbplot = new GroupBarPlot($bplot);
$graph->Add($gbplot);
$graph->title->Set("# of Visited Articles per Month (log scale)");
$graph->title->SetFont(FONT2_BOLD);
$graph->xaxis->SetTickLabels($this->_months);
$graph->ygrid->Show(true, true);
$graph->xaxis->SetFont(FONT1_BOLD);
$graph->yaxis->SetFont(FONT1_BOLD);
$graph->Stroke();
}
示例8: executeGetFunctionGraph
public function executeGetFunctionGraph(sfWebRequest $request)
{
$this->getUrlParameters($request);
$this->fct_id = $request->getParameter('function_id');
$this->fct_ref = $request->getParameter('function_ref');
//récupération du nom pour les affichages.
$this->node = Doctrine_Core::getTable('EiTree')->findOneByRefObjAndObjIdAndType($this->fct_ref, $this->fct_id, 'Function');
//récupération des temps d'execution
$this->times = Doctrine_Core::getTable('EiFonction')->getTimeStats($this->project_id, $this->project_ref, $this->fct_id, $this->fct_ref);
// Width and height of the graph
$width = 700;
$height = 300;
// Create a graph instance
$graph = new Graph($width, $height);
$graph->SetScale('intint');
$graph->title->Set($this->node->getName() . " 's execution time evolution.");
$graph->xaxis->title->Set('Execution');
$graph->yaxis->title->Set('Time (ms)');
$exec = array();
//récupération des durées uniquement
foreach ($this->times as $t => $time) {
$exec[] = $time['l_duree'];
}
$lineplot = new LinePlot($exec);
$graph->Add($lineplot);
$graph->Stroke();
return sfView::NONE;
}
示例9: graficarBarras
function graficarBarras()
{
require_once "jpgraph/src/jpgraph.php";
require_once "jpgraph/src/jpgraph_bar.php";
$datos = array($_GET['pos'], $_GET['neg']);
//Instancia del objeto del tipo Graph en donde como parametro
// se le pasan los valore de ancho y altura
$grafica = new Graph(400, 300);
$grafica->SetScale("textlin");
$grafica->SetBox(false);
//Nombre de las columnas
$columnas = array($_GET['lab1'], $_GET['lab2']);
$grafica->xaxis->SetTickLabels($columnas);
//Objeto del tipo BarPlot que se le enviara a la grafica y el cual
//recibe como parametros los datos a graficar
$barras = new BarPlot($datos);
$grafica->Add($barras);
//Color de los bordes
//Color de borde de las barras
$barras->SetColor("white");
//Color de relleno de las barras
$barras->SetFillColor("#4B0082");
//Ancho de las barras
$barras->SetWidth(45);
// $grafica->title->Set("Gráfica de Barras");
$grafica->title->SetFont(FF_TIMES, FS_ITALIC, 18);
$grafica->Stroke();
}
示例10: 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();
}
示例11: 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' />");
}
示例12: 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}' />");
}
示例13: makeGraph
function makeGraph($x_data, $y_data, $num_results, $title = "Statistics", $graph_type = "bar", $graph_scale = "textint")
{
// default graph info
$width = 600;
$height = 500;
$top = 60;
$bottom = 30;
$left = 80;
$right = 30;
if ($graph_type != 'csv' && $num_results == 0) {
header('Content-type: image/png');
readfile($GLOBALS['BASE_DIR'] . '/images/no-calls.png');
exit;
}
// Set the basic parameters of the graph
switch ($graph_type) {
case "line":
//do line graph here
break;
// not really a graph, returns comma seperated values
// not really a graph, returns comma seperated values
case "csv":
header("content-type: text/csv");
header('Content-Disposition: attachment; filename="statistics.csv"');
$columns = implode(',', $x_data);
$rows = implode(',', $y_data);
echo $columns . "\n" . $rows;
break;
case "bar":
default:
// bar is default
$graph = new Graph($width, 90 + 10 * $num_results, 'auto');
$graph->SetScale($graph_scale);
// Nice shadow
$graph->SetShadow();
$graph->Set90AndMargin($left, $right, $top, $bottom);
// Setup labels
$graph->xaxis->SetTickLabels($x_data);
// 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($y_data);
$bplot->SetFillColor("#708090");
$bplot->SetWidth(0.5);
$bplot->SetYMin(0);
//$bplot->SetYMin(1990);
$graph->title->Set($title);
$graph->Add($bplot);
$graph->Stroke();
}
}
示例14: 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();
}
示例15: 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}' />");
}