當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Graph::SetScale方法代碼示例

本文整理匯總了PHP中Graph::SetScale方法的典型用法代碼示例。如果您正苦於以下問題:PHP Graph::SetScale方法的具體用法?PHP Graph::SetScale怎麽用?PHP Graph::SetScale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Graph的用法示例。


在下文中一共展示了Graph::SetScale方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getGrafmayorcosto

 public function getGrafmayorcosto()
 {
     JpGraph::module('bar');
     $graph = new Graph(680, 300);
     $graph->SetScale("textlin");
     $graph->yscale->SetGrace(5);
     $graph->SetBox(true);
     $labels = array();
     $valores = array();
     foreach (Activo::where('id', '>', '0')->orderBy('costo', 'desc')->take(10)->get() as $activo) {
         $labels[] = $activo->num_activo;
         $valores[] = $activo->costo;
     }
     //titulo de la grafica
     $graph->title->SetColor('black');
     $graph->title->Set('Gráfica: Activos con Mayor Costo');
     //valores de los labels en ambas axis y como se ubicaran
     $graph->xaxis->SetTickLabels($labels);
     $graph->xaxis->SetLabelAlign('center', 'top', 'center');
     $graph->ygrid->SetFill(false);
     $graph->yaxis->HideLabels(false);
     $graph->yaxis->HideTicks(false, false);
     //Fonts para las axis
     $graph->xaxis->SetColor('black');
     $graph->yaxis->SetColor('black');
     //grafica de activos con mayor costo
     $mayorCosto = new BarPlot($valores);
     $mayorCosto->SetColor('white');
     $mayorCosto->SetWidth(0.6);
     //agrega la grafica generada a la instancia de la grafica
     $graph->Add($mayorCosto);
     //Despliega la grafica
     $graph->Stroke();
 }
開發者ID:EdgardoPitti,項目名稱:plagetri21v2,代碼行數:34,代碼來源:GraficarController.php

示例2: 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();
 }
開發者ID:Ethennoob,項目名稱:Web,代碼行數:32,代碼來源:GraphVisitsMonthAllYears.php

示例3: 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;
 }
開發者ID:lendji4000,項目名稱:compose,代碼行數:28,代碼來源:actions.class.php

示例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;
 }
開發者ID:jvasquez8704,項目名稱:sistema-administracion-contratos,代碼行數:35,代碼來源:graphics.php

示例5: monthchart

 function monthchart($xdata, $ydata, $title = 'Line Chart')
 {
     // Create the graph. These two calls are always required
     $graph = new Graph(600, 250, "auto", 60);
     $graph->img->SetAntiAliasing(false);
     $graph->SetScale("textlin");
     $graph->xaxis->SetTickLabels($xdata);
     $graph->xgrid->SetColor('#E3E3E3');
     $graph->legend->SetFrameWeight(1);
     // Setup title
     $graph->title->Set($title);
     foreach ($ydata as $item) {
         // Create the linear plot
         if (count($item['values']) != count($xdata)) {
             continue;
         }
         $lineplot = new LinePlot($item['values'], $xdata);
         $lineplot->SetColor($item['color']);
         if (count($ydata) == 1) {
             $lineplot->SetFillColor($item['color']);
         }
         // Add the plot to the graph
         $graph->Add($lineplot);
         $lineplot->SetLegend($item['legend']);
     }
     return $graph;
 }
開發者ID:FaddliLWibowo,項目名稱:MapIgniter,代碼行數:27,代碼來源:jpgraph.php

示例6: barcart

function barcart($datay)
{
    require_once "jpgraph/jpgraph.php";
    require_once "jpgraph/jpgraph_bar.php";
    // Setup the graph.
    $graph = new Graph(660, 250);
    $graph->SetScale("textlin");
    // Add a drop shadow
    $graph->SetShadow();
    // Adjust the margin a bit to make more room for titles
    $graph->SetMargin(40, 30, 20, 40);
    // Setup the titles
    $graph->title->Set('NHR Registry');
    $graph->xaxis->title->Set('X-title');
    $graph->yaxis->title->Set('Y-title');
    // Create the bar pot
    $bplot = new BarPlot($datay);
    // Adjust fill color
    $bplot->SetFillColor('orange');
    $graph->Add($bplot);
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
    return $graph;
}
開發者ID:JosephMokano,項目名稱:somu-nhr,代碼行數:25,代碼來源:jpgraph_pi.php

示例7: 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();
 }
開發者ID:sdgdsffdsfff,項目名稱:auth-center,代碼行數:33,代碼來源:Registrations.php

示例8: array

 /**
  * Para el tipo de gráfico 'otro' hay que especificar todo lo referente a
  * jpgraph. Desde la inclusión de los archivos necesarios hasta la instanciación
  * de todas las componentes que esta necesita para generar un gráfico.
  * Lo único que hay que hacer es 'avisarle' al gráfico de toba cuál es el
  * canvas que se tiene que dibujar. Todo el resto es legal y bonito
  *
  * @param toba_ei_grafico $grafico
  */
 function conf__grafico(toba_ei_grafico $grafico)
 {
     require_once toba_dir() . '/php/3ros/jpgraph/jpgraph.php';
     require_once toba_dir() . '/php/3ros/jpgraph/jpgraph_contour.php';
     $data = array(array(0.5, 1.1, 1.5, 1, 2.0, 3, 3, 2, 1, 0.1), array(1.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 1, 4), array(0.9, 2.0, 2.1, 3, 6.0, 7, 3, 2, 1, 1.4), array(1.0, 1.5, 3.0, 4, 6.0, 5, 2, 1.5, 1, 2), array(0.8, 2.0, 3.0, 3, 4.0, 4, 3, 2.4, 2, 3), array(0.6, 1.1, 1.5, 1, 4.0, 3.5, 3, 2, 3, 4), array(9.0, 1.5, 3.0, 5, 6.0, 2, 1, 1.2, 2.7, 4), array(9.800000000000001, 9.0, 3.0, 3, 5.5, 6, 3, 2, 1, 1.4), array(9.0, 1.5, 3.0, 4, 6.0, 5, 2, 1, 0.5, 0.2));
     // Setup a basic graph context with some generous margins to be able
     // to fit the legend
     $canvas = new Graph(650, 300);
     $canvas->SetMargin(40, 140, 60, 40);
     $canvas->title->Set('Uso avanzado de la librería');
     $canvas->title->SetFont(FF_ARIAL, FS_BOLD, 14);
     // For contour plots it is custom to use a box style ofr the axis
     $canvas->legend->SetPos(0.05, 0.5, 'right', 'center');
     $canvas->SetScale('intint');
     $canvas->SetAxisStyle(AXSTYLE_BOXOUT);
     $canvas->xgrid->Show();
     $canvas->ygrid->Show();
     // A simple contour plot with default arguments (e.g. 10 isobar lines)
     $cp = new ContourPlot($data);
     // Display the legend
     $cp->ShowLegend();
     // Make the isobar lines slightly thicker
     $cp->SetLineWeight(2);
     $canvas->Add($cp);
     // Con esta llamada informamos al gráfico cuál es el gráfico que se tiene
     // que dibujar
     $grafico->conf()->canvas__set($canvas);
 }
開發者ID:emma5021,項目名稱:toba,代碼行數:37,代碼來源:ci_ejemplo_4.php

示例9: array

 function conf__grafico(toba_ei_grafico $grafico)
 {
     if (isset($this->datos)) {
         $datos = array();
         $leyendas = array();
         foreach ($this->datos as $value) {
             $datos[] = $value['resultado'];
             $leyendas[] = $value['codc_uacad'];
         }
     }
     require_once toba_dir() . '/php/3ros/jpgraph/jpgraph.php';
     require_once toba_dir() . '/php/3ros/jpgraph/jpgraph_bar.php';
     // Setup a basic graph context with some generous margins to be able
     // to fit the legend
     $canvas = new Graph(900, 300);
     $canvas->SetMargin(100, 140, 60, 40);
     $canvas->title->Set('Cr�dito Disponible');
     //$canvas->title->SetFont(FF_ARIAL,FS_BOLD,14);
     // For contour plots it is custom to use a box style ofr the axis
     $canvas->legend->SetPos(0.05, 0.5, 'right', 'center');
     $canvas->SetScale('intint');
     //$canvas->SetAxisStyle(AXSTYLE_BOXOUT);
     //$canvas->xgrid->Show();
     $canvas->ygrid->Show();
     $canvas->xaxis->SetTickLabels($leyendas);
     // A simple contour plot with default arguments (e.g. 10 isobar lines)
     $cp = new BarPlot($datos);
     $cp->SetColor("#B0C4DE");
     $cp->SetFillColor("#B0C4DE");
     $cp->SetLegend("Resultado");
     $canvas->Add($cp);
     // Con esta llamada informamos al gr�fico cu�l es el gr�fico que se tiene
     // que dibujar
     $grafico->conf()->canvas__set($canvas);
 }
開發者ID:pkogan,項目名稱:presupuesto,代碼行數:35,代碼來源:ci_comparacion_unidad.php

示例10: 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();
 }
開發者ID:ckc6cz,項目名稱:ManhattanProject,代碼行數:31,代碼來源:graphs.php

示例11: 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();
}
開發者ID:neymanna,項目名稱:fusionforge,代碼行數:36,代碼來源:graphs.php

示例12: 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();
 }
開發者ID:Ethennoob,項目名稱:Web,代碼行數:25,代碼來源:GraphLanguageYear.php

示例13: 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();
}
開發者ID:youli023023,項目名稱:zabbix_api,代碼行數:26,代碼來源:showimg.php

示例14: 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();
     }
 }
開發者ID:jaironman3008,項目名稱:mercadomundial,代碼行數:25,代碼來源:classgrafico.php

示例15: 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();
}
開發者ID:emacer,項目名稱:Gereho,代碼行數:28,代碼來源:torta3D.php


注:本文中的Graph::SetScale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。