本文整理汇总了PHP中PHPlot::SetXTickPos方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetXTickPos方法的具体用法?PHP PHPlot::SetXTickPos怎么用?PHP PHPlot::SetXTickPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetXTickPos方法的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();
}
示例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();
}
示例3: make_plot
function make_plot($plot_type, $data_type, $nx, $ny)
{
$plot = new PHPlot(1280, 1024);
$plot->SetPrintImage(False);
$plot->SetFailureImage(False);
$plot->SetDataType($data_type);
$plot->SetDataValues(make_data_array($plot_type, $data_type, $nx, $ny, 100));
$plot->SetPlotType($plot_type);
$plot->SetTitle("Serialize/Unserialize Tests\n{$plot_type} - {$data_type}");
$plot->SetXTickIncrement(5);
$plot->SetYTickIncrement(10);
$plot->SetPlotBorderType('full');
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
$plot->SetXTitle('X Axis Title');
$plot->SetYTitle('Y Axis Title');
# Select data labels or tick labels based on data type:
if ($data_type == 'data-data') {
$plot->SetXDataLabelPos('none');
$plot->SetXTickLabelPos('plotdown');
$plot->SetXTickPos('plotdown');
} elseif ($data_type == 'text-data') {
$plot->SetXDataLabelPos('plotdown');
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
} elseif ($data_type == 'data-data-yx') {
$plot->SetYDataLabelPos('none');
$plot->SetYTickLabelPos('plotleft');
$plot->SetYTickPos('plotleft');
} elseif ($data_type == 'text-data-yx') {
$plot->SetYDataLabelPos('plotleft');
$plot->SetYTickLabelPos('none');
$plot->SetYTickPos('none');
}
return $plot;
}
示例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();
}
示例5: array
# this script. The parameters are shown in the defaults array below:
if (!isset($tp)) {
$tp = array();
}
$tp = array_merge(array('title' => 'Tick Count:', 'xmin' => 0, 'xmax' => 98, 'ymin' => 0, 'ymax' => 55, 'xti' => 10, 'yti' => 10), $tp);
require_once 'phplot.php';
# The data points don't matter at all. The range is set with SetPlotAreaWorld.
$data = array(array('', 0, 0), array('', 1, 1));
$p = new PHPlot();
$subtitle = " World: ({$tp['xmin']}, {$tp['ymin']}) :" . " ({$tp['xmax']}, {$tp['ymax']})" . " Tickstep: ({$tp['xti']}, {$tp['yti']})";
$p->SetTitle($tp['title'] . $subtitle);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTitle('X');
$p->SetYTitle('Y');
$p->SetPlotAreaWorld($tp['xmin'], $tp['ymin'], $tp['xmax'], $tp['ymax']);
$p->SetXTickIncrement($tp['xti']);
$p->SetYTickIncrement($tp['yti']);
#$p->SetSkipTopTick(False);
# Draw both grids:
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
# Axes on all sides:
$p->SetXTickPos('both');
$p->SetXTickLabelPos('both');
$p->SetYTickPos('both');
$p->SetYTickLabelPos('both');
$p->SetPlotBorderType('full');
$p->SetPlotType('lines');
$p->DrawGraph();
示例6: sprintf
//.........这里部分代码省略.........
$arr = $this->leerstand_finden_monat($objekt_id, $datum_vormonat);
$anz_leer_vormonat = count($arr);
// unset($arr);
$arr_leer = $this->leerstand_finden_monat($objekt_id, $datum_heute);
$anz_leer_akt = count($arr_leer);
$anz_vermietet = $anz_einheiten_alle - $anz_leer_akt;
$leere = $this->array_intersect_recursive($arr_leer, $arr, 'EINHEIT_KURZNAME');
$vermietete = $this->array_intersect_recursive($arr, $arr_leer, 'EINHEIT_KURZNAME');
$leer_akt_string = '';
$anz__L = count($leere);
if ($anz__L > 0) {
for ($ee = 0; $ee < $anz__L; $ee++) {
$leer_akt_string .= $leere[$ee] . "\n";
}
}
$vermietet_akt_string = '';
$anz__V = count($vermietete);
// print_r($vermietete);
if ($anz__V > 0) {
for ($ee = 0; $ee < $anz__V; $ee++) {
$vermietet_akt_string .= $vermietete[$ee] . "\n";
}
}
// unset($arr);
/*
* $mvs = new mietvertraege;
* $anz_ausgezogene = $mvs->anzahl_ausgezogene_mieter($objekt_id, $jahr, $monat);
* $anz_eingezogene = $mvs->anzahl_eingezogene_mieter($objekt_id, $jahr, $monat);
*/
$bilanz_akt = $anz__V - $anz__L;
// 0-1 = -1;
$z = 0;
/*
* $data[$z][] = "ALLE\nAKTUELL";
* $data[$z][] = $anz_einheiten_alle;
*
* $data[$z][] = 0;
* $data[$z][] = 0;
*
*/
// $z++;
/*
* $data[$z][] = "LEER\nVERM.";
* $data[$z][] = 0;
* $data[$z][] = $anz_vermietet;
* $data[$z][] = $anz_leer_akt;
*/
$data[$z][] = "VOR-\nMONAT";
$data[$z][] = 0;
$data[$z][] = $anz_leer_vormonat;
$z++;
$data[$z][] = "LEER-\nAKTUELL";
$data[$z][] = 0;
$data[$z][] = 0;
$data[$z][] = $anz_leer_akt;
$z++;
$data[$z][] = "LEER\n\n{$leer_akt_string}";
$data[$z][] = '0';
$data[$z][] = '0';
$data[$z][] = $anz__L;
$z++;
$data[$z][] = "VERM.\n\n{$vermietet_akt_string}";
$data[$z][] = '0';
$data[$z][] = $anz__V;
$z++;
$data[$z][] = "BILANZ\nEIN/AUS";
if ($bilanz_akt < 0) {
$data[$z][] = 0;
$data[$z][] = 0;
$data[$z][] = 0;
$data[$z][] = 0;
$data[$z][] = $bilanz_akt;
} else {
$data[$z][] = 0;
$data[$z][] = $bilanz_akt;
}
// $z++;
$plot->SetYDataLabelPos('plotstack');
$plot->SetDataValues($data);
// Main plot title:
$plot->SetTitle("{$oo->objekt_kurzname} {$monat}/{$jahr}");
// 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);
$plot->DrawGraph();
// echo "<hr>$plot->img ";
// $plot->PrintImageFrame();
// $ima = $plot->PrintImage();
$ima = $plot->EncodeImage();
// ob_clean();
return $ima;
// echo "<img src=\"$ima\"></img>";
}
示例7: 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);
}
}
示例8:
//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);
switch ($which_draw_grid) {
case 'x':
$graph->SetDrawXGrid(TRUE);
$graph->SetDrawYGrid(FALSE);
break;
case 'y':
$graph->SetDrawXGrid(FALSE);
$graph->SetDrawYGrid(TRUE);
break;
case 'both':
示例9: Title
$plot->SetFontTTF('x_title', $font, 14);
$plot->SetFontTTF('y_title', $font, 10);
# Disable auto-output:
$plot->SetPrintImage(0);
$title = "Test {$n_plots} Plots with TTF Title (sequence {$title_sequence})";
$y1 = $title_space;
// Top of plot area
for ($i = 0; $i < $n_plots; $i++) {
if ($i == $title_sequence) {
$plot->SetTitle($title);
}
$y2 = $y1 + $height_of_each_plot;
// Bottom of plot area
# fwrite(STDERR, "Plot $i area: min=(80, $y1) : max=(740, $y2)\n");
$plot->SetPlotAreaPixels(80, $y1, 740, $y2);
$plot->SetDataType('text-data');
$plot->SetDataValues($report[$i]);
$plot->SetPlotAreaWorld(NULL, 0, NULL, $max_x);
$plot->SetDataColors(array('blue'));
$plot->SetXTickLabelPos('none');
$plot->SetXDataLabelPos('plotdown');
$plot->SetXTickPos('plotdown');
$plot->SetYTickIncrement(1);
$plot->SetXTitle("Chart {$i} X Values");
$plot->SetYTitle("Chart {$i} Y Values");
$plot->SetPlotType('bars');
$plot->DrawGraph();
$y1 = $y2 + $space_below_plots;
// Start next plot below last plot
}
$plot->PrintImage();
示例10: array
$a = 0.5;
$d_theta = M_PI / 48.0;
for ($theta = M_PI * 7; $theta >= 0; $theta -= $d_theta) {
$data[] = array('', $a * $theta * cos($theta), $a * $theta * sin($theta));
}
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('points');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle('Scatterplot (points plot)');
# Need to set area and ticks to get reasonable choices.
$plot->SetPlotAreaWorld(-12, -12, 12, 12);
$plot->SetXTickIncrement(2);
$plot->SetYTickIncrement(2);
# Move axes and ticks to 0,0, but turn off tick labels:
$plot->SetXAxisPosition(0);
# Is default
$plot->SetYAxisPosition(0);
$plot->SetXTickPos('xaxis');
$plot->SetXTickLabelPos('none');
$plot->SetYTickPos('yaxis');
$plot->SetYTickLabelPos('none');
# Turn on 4 sided borders, now that axes are inside:
$plot->SetPlotBorderType('full');
# Draw both grids:
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
# Is default
$plot->DrawGraph();
示例11: MONTH
function solicitudes_reparacion_por_operario($id_operario, $año)
{
$this->loadModel('ReparacionSolicitud');
$this->loadModel('Funcionario');
$meses = $this->ReparacionSolicitud->query("SELECT MONTH(archivada) AS mes FROM reparacion_solicitudes WHERE estado='a' AND ejecutada=1 AND YEAR(archivada)=" . $año . " GROUP BY MONTH(archivada)");
if (!empty($meses)) {
// Inicializamos el arreglo en ceros (para los meses ke no tienen solicitudes).
$total = array();
for ($i = 1; $i <= 12; $i++) {
$total[$i][0][0] = array('cuenta' => 0);
}
foreach ($meses as $mes) {
$cant_solicitudes = $this->ReparacionSolicitud->query("SELECT COUNT(*) AS cuenta FROM reparacion_solicitudes WHERE id_funcionario=" . $id_operario . " AND estado='a' AND ejecutada=1 AND YEAR(archivada)=" . $año . " AND MONTH(archivada)=" . $mes[0]['mes']);
$total[$mes[0]['mes']] = $cant_solicitudes;
}
if (!empty($total)) {
$operario = $this->Funcionario->find('first', array('conditions' => array('Funcionario.id' => $id_operario), 'fields' => array('Funcionario.nombre')));
foreach ($total as $mes => $arreglo_mes) {
$arreglo_plot[] = array($this->meses[$mes], $arreglo_mes[0][0]['cuenta']);
}
$plot = new PHPlot(890, 450);
$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', 10);
$plot->SetFontTTF('x_label', 'FreeSans.ttf', 10);
$plot->SetFontTTF('y_title', 'FreeSans.ttf', 14);
// Titulos
$plot->SetTitle("\nSolicitudes de reparación\natendidas por " . mb_convert_case($operario['Funcionario']['nombre'], MB_CASE_TITLE, "UTF-8"));
$plot->SetXTitle('AÑO ' . $año);
$plot->SetYTitle('# SOLICITUDES');
// Etiquetas
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetYTickLabelPos('none');
$plot->SetYTickPos('none');
$plot->SetYDataLabelPos('plotin');
$plot->SetDrawXGrid(true);
// Leyenda
$leyenda = array('Solicitudes de Reparación');
$plot->SetLegend($leyenda);
$plot->SetLegendPixels(703, 0);
$plot->SetPlotType('bars');
$plot->SetShading(7);
$plot->DrawGraph();
}
}
}
示例12:
// Remember that angles other than 90 are taken as 0 when working with fixed fonts.
if (isset($stat['x_label_angle'])) {
$graph->SetXLabelAngle($stat['x_label_angle']);
} else {
$graph->SetXLabelAngle(0);
}
$graph->SetYLabelAngle(0);
if (!(isset($stat['tick_increment_y']) && $stat['tick_increment_y'])) {
$stat['tick_increment_y'] = stats__get_y_increment($stat['data']);
}
$graph->SetYTickIncrement($stat['tick_increment_y']);
$graph->SetXTickLabelPos('plotdown');
// plotup, plotdown, both, xaxis, none
$graph->SetYTickLabelPos('both');
// plotleft, plotright, both, yaxis, none
$graph->SetXTickPos('plotdown');
// plotup, plotdown, both, xaxis, none
$graph->SetYTickPos('both');
// plotleft, plotright, both, yaxis, none
//Set some data
if ($stat['reverse_data']) {
$data = array_reverse($stat['data']);
} else {
$data = $stat['data'];
}
$graph->SetDataValues($data);
$graph->SetXTickLabelPos('none');
$graph->SetXTickPos('none');
//echo '<pre>';
//var_dump($stat);
//echo '</pre>';
示例13: array
# <=12 13-17 17-28 30-39 40-54 >=55
$data = array(array('Cherry', 1, 1, 2, 2, 4, 3, 3, 4, 3, 5, 5, 6, 6), array('Apple', 2, 1, 9, 2, 7, 3, 4, 4, 7, 5, 3, 6, 7), array('Pear', 3, '', 2, 2, 2, 3, 3, 4, 4, 5, 3, 6, 2), array('Grape', 4, 1, 8, 2, 5, 3, 5, 4, 6, 5, 3, 6, 4), array('Kiwi', 5, '', 0, 2, 3, 3, 4, 4, 4, 5, 5, 6, 2), array('Banana', 6, 1, 5, 2, 4, 3, 6, 4, 3, 5, 3, 6, 4));
$plot = new PHPlot(600, 600);
$plot->SetTitle("Flavor Preference By Age Group");
$plot->SetDataType('data-data-xyz');
$plot->SetDataValues($data);
$plot->SetPlotType('bubbles');
$plot->SetDataColors('yellow');
// Use same color for all data sets
$plot->SetDrawPlotAreaBackground(True);
$plot->SetPlotBgColor('plum');
$plot->SetLightGridColor('red');
// Change grid color to make it visible
$plot->SetImageBorderType('plain');
$plot->SetPlotBorderType('full');
$plot->SetXTickIncrement(1);
// For grid line spacing
$plot->SetYTickIncrement(1);
$plot->SetPlotAreaWorld(0, 0, 6.5, 6.5);
# Establish the handler for the Y label text:
$plot->SetYLabelType('custom', 'get_label', $y_labels);
$plot->SetXTickPos('both');
// Tick marks on both sides
$plot->SetYTickPos('both');
// Tick marks on top and bottom too
$plot->SetXDataLabelPos('both');
// X axis data labels top and bottom
$plot->SetYTickLabelPos('both');
// Y axis labels left and right
$plot->SetDrawXGrid(True);
$plot->DrawGraph();
示例14: array
# you turn one on PHPlot turns the other off.
# 'xtick' need only be set if you want it different from 'xticklabel', for
# example to have X tick marks and data labels.
$data = array(array('AAA', 0, 0), array('BBB', 1, 8), array('CCC', 2, 3), array('DDD', 3, 7), array('EEE', 4, 5));
$p = new PHPlot(400, 300);
$p->SetTitle($tp['title'] . $tp['suffix']);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotAreaWorld(0, 0, 4, 10);
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(1);
$p->SetPlotBorderType('full');
$p->SetXDataLabelPos($tp['xdatalabel']);
$p->SetXTickLabelPos($tp['xticklabel']);
if (isset($tp['xtick'])) {
$p->SetXTickPos($tp['xtick']);
} else {
$p->SetXTickPos($tp['xticklabel']);
}
$p->SetYTickLabelPos($tp['yticklabel']);
$p->SetYTickPos($tp['yticklabel']);
$p->SetXTitle('X TITLE');
$p->SetYTitle('Y TITLE');
# Tick skip tests:
if (isset($tp['skiptick'])) {
$s = $tp['skiptick'];
$n = strlen($s);
for ($i = 0; $i < $n; $i++) {
switch ($s[$i]) {
case 'T':
$p->SetSkipTopTick(True);
示例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();
}
}
}