当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPlot::SetLegend方法代码示例

本文整理汇总了PHP中PHPlot::SetLegend方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetLegend方法的具体用法?PHP PHPlot::SetLegend怎么用?PHP PHPlot::SetLegend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPlot的用法示例。


在下文中一共展示了PHPlot::SetLegend方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: graficoBarra

function graficoBarra($data, $archivo = "", $meta_data = array('titulo' => 'Sin Título', 'tituloX' => 'Eje X', 'tituloY' => 'Eje Y', 'color' => 'SkyBlue', 'width' => 800, 'height' => 600, 'angle' => 45), $legend = array("Datos"))
{
    # Objeto que crea el gráfico y su tama?o
    $plot = new PHPlot($meta_data['width'], $meta_data['height']);
    $plot->SetImageBorderType('plain');
    # Setea el archivo donde se guarda la imagen generada y no permite la visualización inmediata
    $plot->SetPrintImage(false);
    $plot->SetFileFormat("jpg");
    $plot->SetOutputFile($archivo);
    $plot->SetIsInline(true);
    # Envio de datos
    $plot->SetDataValues($data);
    # Tipo de gráfico y datos
    $plot->SetDataType("text-data");
    $plot->SetPlotType("bars");
    # Setiando el True type font
    //$plot->SetTTFPath(TTFPath);
    //$plot->SetUseTTF(TRUE);
    $plot->SetAxisFontSize(2);
    $plot->SetVertTickIncrement(7);
    //$plot->SetXTickLength(7);
    //$plot->SetDataColors($meta_data['color']);
    $plot->SetDataColors(array($meta_data['color'], 'red', 'white'));
    $plot->SetLegendPixels(1, 1);
    $plot->SetLegend($legend);
    # Etiquetas del eje Y:
    $plot->SetYTitle($meta_data['tituloY']);
    $plot->SetYDataLabelPos('plotin');
    # Título principal del gráfico:
    $plot->SetTitle($meta_data['titulo']);
    # Etiquetas eje X:
    $plot->SetXTitle($meta_data['tituloX']);
    if (isset($meta_data['angle'])) {
        $plot->SetXLabelAngle($meta_data['angle']);
    } else {
        $plot->SetXLabelAngle(45);
    }
    $plot->SetXTickLabelPos('none');
    $plot->SetXTickPos('none');
    # Método que dibuja el gráfico
    $plot->DrawGraph();
    $plot->PrintImage();
}
开发者ID:ranmadxs,项目名称:dorcl,代码行数:43,代码来源:genera_graficos.php

示例2: plotGraph

function plotGraph($data)
{
    //Define the object
    $plot = new PHPlot();
    $example_data = $data;
    $plot->SetDataValues($example_data);
    $plot->SetDataType('data-data');
    //Set titles
    $plot->SetTitle("temp and humi");
    $plot->SetXTitle('time');
    $plot->SetYTitle('Y Data');
    $legend = array('temp', 'humi');
    $plot->SetLegend($legend);
    $plot->SetXDataLabelAngle(90);
    //$plot->SetXGridLabelType("time");
    $plot->SetXTickLabelPos('xaxis');
    $plot->SetXTickPos('plotdown');
    $plot->SetXLabelType('time', '%H:%M');
    $plot->TuneXAutoTicks(10, 'date');
    //	$plot->SetXTickIncrement(.5);
    //$plot->SetXTickIncrement(60 * 24);
    $plot->SetPlotType('lines');
    //$plot->SetPlotAreaWorld(strtotime('00:00'), null, strtotime('23:59'), null);
    $plot->SetDrawXGrid(true);
    //Draw it
    $plot->DrawGraph();
}
开发者ID:SuichiesS,项目名称:homewatch,代码行数:27,代码来源:phpplot1.php

示例3: doGet

 public function doGet(WebAppRequest $req, WebAppResponse $res)
 {
     // Bootstraps Innomatic
     require_once 'innomatic/core/InnomaticContainer.php';
     $innomatic = InnomaticContainer::instance('innomaticcontainer');
     // Sets Innomatic base URL
     $baseUrl = '';
     $webAppPath = $req->getUrlPath();
     if (!is_null($webAppPath) && $webAppPath != '/') {
         $baseUrl = $req->generateControllerPath($webAppPath, true);
     }
     $innomatic->setBaseUrl($baseUrl);
     $innomatic->setInterface(InnomaticContainer::INTERFACE_WEB);
     $home = WebAppContainer::instance('webappcontainer')->getCurrentWebApp()->getHome();
     $innomatic->bootstrap($home, $home . 'core/conf/innomatic.ini');
     $id = basename($req->getParameter('id'));
     //$id = basename($_GET['id']);
     $args = unserialize(file_get_contents(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id));
     require_once 'phplot/PHPlot.php';
     $graph = new PHPlot($args['width'], $args['height']);
     $graph->SetIsInline('1');
     //$graph->SetDataColors( array("blue",'white'),array("black") );
     //$graph->$line_style = array('dashed','dashed','solid','dashed','dashed','solid');
     // Base
     $graph->SetDataValues($args['data']);
     $graph->SetPlotType($args['plottype']);
     // Appearance
     $graph->SetPointShape($args['pointshape']);
     $graph->SetPointSize($args['pointsize']);
     $graph->SetTitle($args['title']);
     // Color
     $graph->SetBackgroundColor($args['backgroundcolor']);
     $graph->SetGridColor($args['gridcolor']);
     if (count($args['legend'])) {
         $graph->SetLegend($args['legend']);
     }
     $graph->SetLineWidth($args['linewidth']);
     $graph->SetTextColor($args['textcolor']);
     $graph->SetDataColors(array(array(145, 165, 207), array(114, 167, 112), array(71, 85, 159), array(175, 83, 50), array(247, 148, 53), array(240, 231, 125), array(154, 204, 203), array(201, 164, 196)), 'black');
     //$graph->data_color = array( array(145,165,207), array(114,167,112), array(71,85,159), array(175,83,50), array(247,148,53), array(240,231,125), array(154,204,203), array(201,164,196) );
     //array('blue','green','yellow','red','orange');
     $graph->DrawGraph();
     unlink(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id);
 }
开发者ID:innomatic-libs,项目名称:phplotlib,代码行数:44,代码来源:PHPlotWebAppHandler.php

示例4: testBars

function testBars()
{
    # PHPlot Example: Bar chart, 3 data sets, unshaded
    $data = array(array('Jan', 40, 2, 4), array('Feb', 30, 3, 4), array('Mar', 20, 4, 4), array('Apr', 10, 5, 4), array('May', 3, 6, 4), array('Jun', 7, 7, 4), array('Jul', 10, 8, 4), array('Aug', 15, 9, 4), array('Sep', 20, 5, 4), array('Oct', 18, 4, 4), array('Nov', 16, 7, 4), array('Dec', 14, 3, 4));
    $plot = new PHPlot(800, 600);
    $plot->SetIsInline(true);
    $plot->SetImageBorderType('plain');
    $plot->SetPlotType('bars');
    $plot->SetDataType('text-data');
    $plot->SetDataValues($data);
    # Main plot title:
    $plot->SetTitle('Unshaded Bar Chart with 3 Data Sets');
    # No 3-D shading of the bars:
    $plot->SetShading(0);
    # Make a legend for the 3 data sets plotted:
    $plot->SetLegend(array('Engineering', 'Manufacturing', 'Administration'));
    # Turn off X tick labels and ticks because they don't apply here:
    $plot->SetXTickLabelPos('none');
    $plot->SetXTickPos('none');
    $plot->DrawGraph();
}
开发者ID:SuichiesS,项目名称:homewatch,代码行数:21,代码来源:phplotbars.php

示例5: mietvertraege

 function plotfile_me($pdf, $mv_id, $w = 800, $h = 600)
 {
     $mvs = new mietvertraege();
     $mvs->get_mietvertrag_infos_aktuell($mv_id);
     $mk = new mietkonto();
     $datum_mietdefinition = $mk->datum_1_mietdefinition($mv_id);
     // echo "<h1>$datum_mietdefinition</h1>";
     $a_dat = explode('-', $datum_mietdefinition);
     $jahr_a = date("Y") - 2;
     $jahr_e = date("Y") + 3;
     $jahre = $jahr_e - $jahr_a;
     $z = 0;
     for ($jahr = $jahr_a; $jahr <= $jahr_e; $jahr++) {
         $monat = date("m");
         $mk->kaltmiete_monatlich($mv_id, $monat, $jahr);
         if ($jahr > $jahr_a) {
             $miete_vorjahr = $arr_stat[$z - 1][1];
             $prozent = ($mk->ausgangs_kaltmiete - $miete_vorjahr) / ($miete_vorjahr / 100);
         } else {
             $prozent = 0;
         }
         $prozent = nummer_punkt2komma($prozent);
         $arr_stat[$z][0] = "{$jahr}\n{$mk->ausgangs_kaltmiete}\nEUR\n{$prozent} %";
         $arr_stat[$z][1] = $mk->ausgangs_kaltmiete;
         $z++;
     }
     // print_r($arr_stat);
     require_once 'phplot.php';
     $plot = new PHPlot($w, $h);
     $plot->SetImageBorderType('plain');
     $plot->SetPlotType('bars');
     $plot->SetDataType('text-data');
     $plot->SetDataValues($arr_stat);
     // Main plot title:
     $plot->SetTitle('MIETENTWICKLUNG' . " {$mvs->einheit_kurzname} \n {$mvs->personen_name_string}");
     // No 3-D shading of the bars:
     $plot->SetShading(0);
     // Make a legend for the 3 data sets plotted:
     // $plot->SetLegend(array('Mieteinnahmen', 'Leerstand'));
     $plot->SetLegend(array('MIETE'));
     // Turn off X tick labels and ticks because they don't apply here:
     $plot->SetXTickLabelPos('none');
     $plot->SetXTickPos('none');
     // Draw it
     $plot->SetIsInline(true);
     $img = $plot->DrawGraph();
     $px = 'px';
     // echo "<hr>$plot->img ";
     // $plot->PrintImageFrame();
     // $hhh = $plot->PrintImage();
     $ima = $plot->EncodeImage();
     // echo "<a style=\"width:$w$px;heigth:$h$px;\" href=\"?option=stat_mv_big&mv_id=$mv_id\"><img style=\"width:$w$px;heigth:$h$px;\" src=\"$plot->img\"></img></a>";
     // die();
     // echo "<img src=\"$ima\">";
     // die();
     if ($mvs->mietvertrag_aktuell == 1) {
         $pdf->ezNewPage();
         $druckdatum = date("d.m.Y");
         $pdf->addText(464, 730, 7, "<b>Druckdatum: {$druckdatum}</b>");
         $pdf->addPngFromFile($ima, $pdf->x + 10, $pdf->y - $h, $w, $h);
     }
 }
开发者ID:BerlusGmbH,项目名称:Berlussimo,代码行数:62,代码来源:class_stammdaten.php

示例6: array

<?php

# Testing phplot - Line-Points, extensions to suppress either
# the line or the points on each plot.
# $Id$
require_once 'phplot.php';
$data = array(array('', 1, 1, 2, 3), array('', 2, 2, 3, 4), array('', 3, 3, 4, 5), array('', 4, 4, 5, 6), array('', 5, 5, 6, 7), array('', 6, 6, 7, 8), array('', 7, 7, 8, 9), array('', 8, 8, 9, 10), array('', 9, 9, 10, 11), array('', 10, 10, 11, 12));
$p = new PHPlot();
$p->SetTitle('PlotType: linepoints with suppression');
$p->SetDataType('data-data');
$p->SetDataValues($data);
# We don't use the data labels (all set to '') so might as well turn them off:
$p->SetXDataLabelPos('none');
# Need to set area and ticks to get reasonable choices.
#  Increase X range to make room for the legend.
$p->SetPlotAreaWorld(0, 0, 13, 20);
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(2);
$p->SetDataColors(array('red', 'green', 'blue'));
$p->SetPointShapes(array('circle', 'none', 'diamond'));
$p->SetLineStyles(array('solid', 'solid', 'none'));
$p->SetLegend(array('circle+line', 'line only', 'diamond only'));
# Make the points bigger so we can see them:
$p->SetPointSizes(10);
# Draw both grids:
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
# The default
$p->SetPlotType('linepoints');
$p->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:30,代码来源:linepoints-suppress.php

示例7: array

$tp = array_merge(array('title' => 'Transparent Background', 'suffix' => " (default)", 'FFormat' => NULL), $tp);
require_once 'phplot.php';
$data = array(array('', -4, -64, 16, 40), array('', -3, -27, 9, 30), array('', -2, -8, 4, 20), array('', -1, -1, 1, 10), array('', 0, 0, 0, 0), array('', 1, 1, 1, -10), array('', 2, 8, 4, -20), array('', 3, 27, 9, -30), array('', 4, 64, 16, -40));
$p = new PHPlot();
# File format GIF or PNG, to test transparency:
if (isset($tp['FFormat'])) {
    $p->SetFileFormat($tp['FFormat']);
}
# Background color will be transparent:
$p->SetBackgroundColor('yellow');
$p->SetTransparentColor('yellow');
$p->SetTitle($tp['title'] . $tp['suffix']);
$p->SetDataType('data-data');
$p->SetDataValues($data);
# We don't use the data labels (all set to '') so might as well turn them off:
$p->SetXDataLabelPos('none');
# Need to set area and ticks to get reasonable choices.
$p->SetPlotAreaWorld(-4, -70, 4, 80);
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(10);
# Don't use dashes for 3rd line:
$p->SetLineStyles('solid');
# Make the lines thicker:
$p->SetLineWidths(3);
# Draw both grids:
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
# And a legend:
$p->SetLegend(array('x^3', 'x^2', '-10x'));
$p->SetPlotType('lines');
$p->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:transparent.php

示例8: array

<?php

# PHPlot Example: Stacked Bars, shaded
require_once 'phplot.php';
$data = array(array('Jan', 40, 5, 10, 3), array('Feb', 90, 8, 15, 4), array('Mar', 50, 6, 10, 4), array('Apr', 40, 3, 20, 4), array('May', 75, 2, 10, 5), array('Jun', 45, 6, 15, 5), array('Jul', 40, 5, 20, 6), array('Aug', 35, 6, 12, 6), array('Sep', 50, 5, 10, 7), array('Oct', 45, 6, 15, 8), array('Nov', 35, 6, 20, 9), array('Dec', 40, 7, 12, 9));
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('stackedbars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
$plot->SetTitle('Candy Sales by Month and Product');
$plot->SetYTitle('Millions of Units');
$plot->SetLegend(array('Chocolates', 'Mints', 'Hard Candy', 'Sugar-Free'));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:16,代码来源:stackedbars1.php

示例9: PHPlot

        }
    }
}
////////////////////////////////////////////////
//Required Settings
include "../phplot.php";
$graph = new PHPlot($xsize_in, $ysize_in);
$graph->SetDataType($which_data_type);
// Must be first thing
$graph->SetDataValues($data);
//Optional Settings (Don't need them)
//	$graph->SetTitle("This is a\n\rmultiple line title\n\rspanning three lines.");
$graph->SetTitle($title);
$graph->SetXTitle($xlbl, $which_xtitle_pos);
$graph->SetYTitle($ylbl, $which_ytitle_pos);
$graph->SetLegend(array("A", "Bee", "Cee", "Dee"));
$graph->SetFileFormat($which_fileformat);
$graph->SetPlotType($which_plot_type);
$graph->SetUseTTF($which_use_ttf);
$graph->SetYTickIncrement($which_yti);
$graph->SetXTickIncrement($which_xti);
$graph->SetXTickLength($which_xtl);
$graph->SetYTickLength($which_ytl);
$graph->SetXTickCrossing($which_xtc);
$graph->SetYTickCrossing($which_ytc);
$graph->SetXTickPos($which_xtick_pos);
$graph->SetYTickPos($which_ytick_pos);
$graph->SetShading($which_shading);
$graph->SetLineWidth($which_line_width);
$graph->SetErrorBarLineWidth($which_errorbar_line_width);
$graph->SetDrawDashedGrid($which_dashed_grid);
开发者ID:alexpagnoni,项目名称:phplot,代码行数:31,代码来源:create_chart.php

示例10: PHPlot

<?php

require_once './conexao.php';
//Include the code
require_once './phplot/phplot.php';
//Define the object
$plot = new PHPlot();
$buscar = mysql_query("SELECT count(id), bairro FROM " . " ocorrencia GROUP BY bairro ORDER BY count(id) DESC");
$data = array();
while ($ver = mysql_fetch_array($buscar)) {
    $data[] = array($ver['bairro'], $ver['count(id)']);
}
$plot->SetTitleColor('blue');
//$plot->SetTitle("");
$plot->SetImageBorderType('plain');
#$plot->SetBackgroundColor('YellowGreen');
$plot->SetPlotType('pie');
$plot->SetDataType('text-data-single');
$plot->SetDataValues($data);
foreach ($data as $row) {
    $plot->SetLegend($row[0]);
}
// Copy labels to legend
$plot->DrawGraph();
开发者ID:jhonatans01,项目名称:segurapp,代码行数:24,代码来源:grafico-pie.php

示例11: PHPlot

}
# Create a PHPlot object which will make an 800x400 pixel image:
$p = new PHPlot(800, 400);
# Use TrueType fonts:
//$p->SetDefaultTTFont('./arial.ttf');
# Set the main plot title:
$p->SetTitle('PHPlot Customer Satisfaction (estimated)');
# Select the data array representation and store the data:
$p->SetDataType('text-data');
$p->SetDataValues($data);
# Select the plot type - bar chart:
$p->SetPlotType('bars');
# Define the data range. PHPlot can do this automatically, but not as well.
$p->SetPlotAreaWorld(0, 0, 9, 100);
# Select an overall image background color and another color under the plot:
$p->SetBackgroundColor('#ffffcc');
$p->SetDrawPlotAreaBackground(True);
$p->SetPlotBgColor('#ffffff');
# Draw lines on all 4 sides of the plot:
$p->SetPlotBorderType('full');
# Set a 3 line legend, and position it in the upper left corner:
$p->SetLegend(array('Features', 'Bugs', 'Happy Users'));
$p->SetLegendWorld(0.1, 95);
# Turn data labels on, and all ticks and tick labels off:
$p->SetXDataLabelPos('plotdown');
$p->SetXTickPos('none');
$p->SetXTickLabelPos('none');
$p->SetYTickPos('none');
$p->SetYTickLabelPos('none');
# Generate and output the graph now:
$p->DrawGraph();
开发者ID:laiello,项目名称:wenderpereira,代码行数:31,代码来源:modelo.php

示例12: array

<?php

# $Id$
# PHPlot Example:  Flat Pie with options
require_once 'phplot.php';
$data = array(array('', 10), array('', 20), array('', 30), array('', 35), array('', 5));
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetDataType('text-data-single');
$plot->SetDataValues($data);
$plot->SetPlotType('pie');
$colors = array('red', 'green', 'blue', 'yellow', 'cyan');
$plot->SetDataColors($colors);
$plot->SetLegend($colors);
$plot->SetShading(0);
$plot->SetLabelScalePosition(0.2);
$plot->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:17,代码来源:pie3.php

示例13: array

require_once 'phplot.php';
# To test with other plot types, scripts can set $plot_type and then
# include this script.
if (empty($plot_type)) {
    $plot_type = 'linepoints';
}
$data = array();
$nx = 20;
$ny = 5;
for ($x = 0; $x < $nx; $x++) {
    $row = array('', $x);
    for ($iy = 0; $iy < $ny; $iy++) {
        $row[] = $ny - $iy;
    }
    $data[] = $row;
}
$shapes = array('dot', 'bowtie', 'none', 'rect', 'none');
for ($iy = 0; $iy < 5; $iy++) {
    $legend[$iy] = "Data Set #{$iy} using shape {$shapes[$iy]}";
}
$p = new PHPlot(800, 600);
$p->SetTitle("{$plot_type} plot with legend using point shapes, and\n" . "shape='none' on 2 of the data sets");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType($plot_type);
$p->SetLineStyles('solid');
$p->SetDrawYGrid(False);
$p->SetPointShapes($shapes);
$p->SetLegend($legend);
$p->SetLegendUseShapes(True);
$p->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:useshape-noshape.php

示例14: array

}
# The variable $plot_type can be set in another script as well.
if (empty($plot_type)) {
    $plot_type = 'linepoints';
}
# Use data labels to display only the points we want,
# but specify the same values for X to get the correct
# spacing.
$data = array(array('1990', 1990, 41308, 21015, 62634), array('1995', 1995, 44310, 13883, 61529), array('2000', 2000, 46772, 9000, 59421), array('2004', 2004, 46887, 7738, 57754), array('2006', 2006, 45441, 6888, 53179), array('2008', 2008, 42757, 5840, 49115));
$legend_text = array('Morning Papers', 'Evening Papers', 'Sunday Papers');
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
// Improves presentation in the manual
$plot->SetTitle("US Daily Newspaper Circulation\n" . $plot_type . ' plot with SetLegendUseShapes(' . ($use_shapes ? 'True' : 'False') . ')');
$plot->SetPlotType($plot_type);
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
$plot->SetPlotAreaWorld(1988, 0, 2010, 80000);
$plot->SetYTickIncrement(10000);
$plot->SetLegend($legend_text);
$plot->SetXTickPos('none');
$plot->SetDrawXDataLabelLines(True);
$plot->SetLegendUseShapes($use_shapes);
// Use color boxes or shapes
$plot->SetPointSizes(12);
// Make points bigger for visibility
$plot->SetLineStyles('solid');
// Make all lines solid
$plot->SetLineWidths(2);
// Make all lines thicker
$plot->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:legendshape.php

示例15: array

 function costo_externo_interno_año($id_oficina, $año)
 {
     $this->autoLayout = false;
     $this->autoRender = false;
     $this->loadModel('CentroCosto');
     $sql_oficina = '';
     if ($id_oficina != 0) {
         $sql_oficina = " AND Cencos_id='" . $id_oficina . "' ";
         $cenco = $this->CentroCosto->find('first', array('fields' => array('CentroCosto.Cencos_nombre'), 'conditions' => array('CentroCosto.Cencos_id' => $id_oficina)));
         $subtitulo_oficina = 'la dependencia ' . mb_convert_case($cenco['CentroCosto']['Cencos_nombre'], MB_CASE_TITLE, "UTF-8");
     } else {
         $subtitulo_oficina = 'todas las dependencias';
     }
     $meses = $this->Solicitud->query("SELECT MONTH(solucionada) AS mes FROM solicitudes WHERE estado='s' " . $sql_oficina . " AND YEAR(solucionada)=" . $año . " GROUP BY MONTH(solucionada)");
     if (!empty($meses)) {
         // Inicializamos el arreglo en ceros (para los meses ke no tienen solicitudes).
         $totales = array();
         for ($i = 1; $i <= 12; $i++) {
             $totales[$i][0][0] = array('costo_i' => 0, 'costo_e' => 0);
         }
         foreach ($meses as $mes) {
             $costos_e_i = $this->Solicitud->query("SELECT SUM(costo_externo) AS costo_e, SUM(costo_interno) AS costo_i FROM solicitudes WHERE estado='s' AND YEAR(solucionada)=" . $año . " AND MONTH(solucionada)=" . $mes[0]['mes']);
             $totales[$mes[0]['mes']] = $costos_e_i;
         }
         if (!empty($totales)) {
             $total_costo_interno = $total_costo_externo = 0;
             $i = 0;
             $arreglo_plot = array();
             foreach ($totales as $mes => $arreglo_mes) {
                 // se construye el array para el PHPlot.
                 if (count($arreglo_mes) > 0) {
                     $arreglo_plot[$i] = array($this->meses[$mes], $arreglo_mes[0][0]['costo_i'], $arreglo_mes[0][0]['costo_e']);
                     $total_costo_interno += $arreglo_mes[0][0]['costo_i'];
                     $total_costo_externo += $arreglo_mes[0][0]['costo_e'];
                 } else {
                     $arreglo_plot[$i] = array($this->meses[$mes], 0, 0);
                 }
                 $i++;
             }
             $plot = new PHPlot(1790, 500);
             $plot->SetDataValues($arreglo_plot);
             $plot->SetDataType('text-data');
             // Fuentes
             $plot->SetUseTTF(true);
             $plot->SetFontTTF('legend', 'FreeSans.ttf', 9);
             $plot->SetFontTTF('title', 'FreeSans.ttf', 14);
             $plot->SetFontTTF('y_label', 'FreeSans.ttf', 9);
             $plot->SetFontTTF('x_label', 'FreeSans.ttf', 10);
             $plot->SetFontTTF('y_title', 'FreeSans.ttf', 14);
             $plot->SetFontTTF('x_title', 'FreeSans.ttf', 12);
             // Titulos
             $plot->SetTitle("\nTotal de costos internos/externos\n" . "de " . $subtitulo_oficina . " en el año " . $año . "\n TOTAL Costo Interno = \$" . $total_costo_interno . "\n" . "TOTAL Costo Externo = \$" . $total_costo_externo);
             $plot->SetYTitle('$ COSTO');
             // Etiquetas
             $plot->SetXTickLabelPos('none');
             $plot->SetXTickPos('none');
             $plot->SetYTickLabelPos('none');
             $plot->SetYTickPos('none');
             $plot->SetYDataLabelPos('plotin');
             $plot->SetDrawXGrid(true);
             // Leyenda
             $leyenda = array('Costo Interno', 'Costo Externo');
             $plot->SetLegend($leyenda);
             $plot->SetLegendPixels(27, 0);
             $plot->SetDataColors(array('beige', 'YellowGreen'));
             $plot->SetPlotType('bars');
             $plot->SetShading(5);
             $plot->DrawGraph();
         }
     }
 }
开发者ID:hongo-de-yuggoth,项目名称:SIMAU,代码行数:71,代码来源:reportes_estadisticos_controller.php


注:本文中的PHPlot::SetLegend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。