本文整理汇总了PHP中PHPlot::SetXTickLabelPos方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetXTickLabelPos方法的具体用法?PHP PHPlot::SetXTickLabelPos怎么用?PHP PHPlot::SetXTickLabelPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetXTickLabelPos方法的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: BuatBarGraph
function BuatBarGraph($filetujuan, $prevtahun, $tahun, $arrStatusAplikan, $urutan, $gel)
{
$arrPrevTotal = array();
$arrCurTotal = array();
FillArrayPeriod($arrPrevTotal, $arrStatusAplikan, $prevtahun, $gel);
FillArrayPeriod($arrCurTotal, $arrStatusAplikan, $tahun, $gel);
$maxPrevHeight = 0;
$maxCurHeight = 0;
foreach ($arrStatusAplikan as $stat) {
$data[] = array($stat, $arrPrevTotal[$stat], $arrCurTotal[$stat]);
$maxPrevHeight = $maxPrevHeight < $arrPrevTotal[$stat] ? $arrPrevTotal[$stat] : $maxPrevHeight;
$maxCurHeight = $maxCurHeight < $arrCurTotal[$stat] ? $arrCurTotal[$stat] : $maxCurHeight;
}
$plot = new PHPlot(800, 600);
//$plot->SetImageBorderType('raised');
$plot->SetFont('y_label', 5);
$plot->SetFont('x_label', 5);
$plot->SetFont('title', 5);
$plot->SetFont('legend', 5);
$plot->setShading(10);
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
$plot->SetTitle('GRAFIK & DATA PMB GEL SISIPAN');
$plot->SetLegend(array($prevtahun, $tahun));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$maxHeight = $maxPrevHeight < $maxCurHeight ? $maxCurHeight : $maxPrevHeight;
$increment = $maxHeight <= 50 ? 5 : ($maxHeight <= 100 ? 10 : ($maxHeight <= 500 ? 50 : 100));
$plot->SetYTickIncrement($increment);
$plot->SetYDataLabelPos('plotin');
$plot->SetIsInline(true);
$plot->SetOutputFile($filetujuan);
$plot->DrawGraph();
}
示例6: makePngGraph
/**
* Generate a graph for this tag
* @param string $tag
* @param string $filePath
* @return bool, success
*/
public function makePngGraph( $tag, $filePath ) {
if( !function_exists( 'ImageCreate' ) ) {
// GD is not installed
return false;
}
global $wgPHPlotDir, $wgMemc;
require_once( "$wgPHPlotDir/phplot.php" ); // load classes
// Define the object
$plot = new PHPlot( 1000, 400 );
// Set file path
$dir = dirname($filePath);
// Make sure directory exists
if( !file_exists($dir) && !wfMkdirParents( $dir, 0777, __METHOD__ ) ) {
throw new MWException( 'Could not create file directory!' );
}
$plot->SetOutputFile( $filePath );
$plot->SetIsInline( true );
$data = array();
$totalVal = $totalCount = $n = 0;
// Define the data using the DB rows
list($res,$u,$maxC,$days) = $this->doQuery( $tag );
if( !$maxC ) {
return false;
}
// Label spacing
$int = intval( ceil($days/10) ); // 10 labels at most
foreach( $res as $row ) {
$totalVal += (int)$row->rfh_total;
$totalCount += (int)$row->rfh_count;
$dayCount = (real)$row->rfh_count;
if( !$row->rfh_count ) {
continue; // bad data
}
// Nudge values up by 1
$dayAve = 1 + (real)$row->rfh_total/(real)$row->rfh_count;
$cumAve = 1 + (real)$totalVal/(real)$totalCount;
$year = intval( substr( $row->rfh_date, 0, 4 ) );
$month = intval( substr( $row->rfh_date, 4, 2 ) );
$day = intval( substr( $row->rfh_date, 6, 2 ) );
# Fill in days with no votes to keep spacing even
if( isset($lastDate) ) {
$dayGap = wfTimestamp(TS_UNIX,$row->rfh_date) - wfTimestamp(TS_UNIX,$lastDate);
$x = intval( $dayGap/86400 );
# Day gaps...
for( $x; $x > 1; --$x ) {
$data[] = array("",$lastDAve,$lastRAve,0);
$n++;
}
}
$n++;
# Label point?
if( $n >= $int || !count($data) ) {
$p = ($days > 31) ? "{$month}-".substr( $year, 2, 2 ) : "{$month}/{$day}";
$n = 0;
} else {
$p = "";
}
$data[] = array( $p, $dayAve, $cumAve, $dayCount );
$lastDate = $row->rfh_date;
$lastDAve = $dayAve;
$lastRAve = $cumAve;
}
// Minimum sample size
if( count($data) < 2 ) {
return false;
}
// Re-scale voter count to fit to graph
$this->dScale = ceil($maxC/5);
// Cache the scale value to memory
$key = wfMemcKey( 'feedback', 'scale', $this->page->getArticleId(), $this->period );
$wgMemc->set( $key, $this->dScale, 7*24*3600 );
// Fit to [0,4]
foreach( $data as $x => $dataRow ) {
$data[$x][3] = $dataRow[3]/$this->dScale;
}
$plot->SetDataValues($data);
$plot->SetPointShapes( array('dot','dot','dot') );
$plot->setPointSizes( array(1,1,4) );
$plot->SetDataColors( array('blue','green','red') );
$plot->SetLineStyles( array('solid','solid','solid') );
$plot->SetBackgroundColor('#F8F8F8');
// Turn off X axis ticks and labels because they get in the way:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetYTickIncrement( .5 );
// Set plot area
$plot->SetPlotAreaWorld( 0, 0, null, 5 );
// Show total number of votes
$plot->SetLegend( array("#{$totalCount}") );
// Draw it!
$plot->DrawGraph();
return true;
}
示例7: mktime
# To get a repeatable test with 'random' data:
mt_srand(1);
# Need a base date/time: Can't just use 0 due to UTC/local differences:
$base_time = mktime(0, 0, 0, 1, 1, 2000);
# Twenty minutes:
$interval = 20 * 60;
# Random data at intervals:
$data = array();
$t = $base_time;
for ($i = 1; $i <= 12; $i++) {
$data[] = array('', $t, mt_rand(0, 100));
$t += $interval;
}
$p = new PHPlot(600, 400);
$p->SetTitle('Meaningless Data with Time X Tick Labels');
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXLabelType('time');
$p->SetXTimeFormat('%H:%M');
$p->SetXTitle('Elapsed Time (hours:minutes)');
# Turn off X data labels, use tick labels only:
$p->SetXDataLabelPos('none');
$p->SetXTickLabelPos('plotdown');
# Even though tick values are given, it makes up its own unless:
$p->SetXTickIncrement($interval);
$p->SetDrawXGrid(True);
# Set the Y min and max, since the data is 0:100
$p->SetPlotAreaWorld(NULL, 0, NULL, 100);
$p->SetYTitle('Meaningless Value');
$p->SetPlotType('lines');
$p->DrawGraph();
示例8:
$graph->SetDrawXGrid(TRUE);
$graph->SetDrawYGrid(FALSE);
break;
case 'y':
$graph->SetDrawXGrid(FALSE);
$graph->SetDrawYGrid(TRUE);
break;
case 'both':
$graph->SetDrawXGrid(TRUE);
$graph->SetDrawYGrid(TRUE);
break;
case 'none':
$graph->SetDrawXGrid(FALSE);
$graph->SetDrawYGrid(FALSE);
}
$graph->SetXTickLabelPos($which_xtick_label_pos);
$graph->SetYTickLabelPos($which_ytick_label_pos);
$graph->SetXDataLabelPos($which_xdata_label_pos);
$graph->SetYDataLabelPos($which_ydata_label_pos);
// Please remember that angles other than 90 are taken as 0 when working fith fixed fonts.
$graph->SetXLabelAngle($which_xlabel_angle);
$graph->SetYLabelAngle($which_ylabel_angle);
//$graph->SetLineStyles(array("dashed","dashed","solid","solid"));
$graph->SetPointShape($which_point);
$graph->SetPointSize($which_point_size);
$graph->SetDrawBrokenLines($which_broken);
// Some forms in format_chart.php don't set this variable, suppress errors.
@$graph->SetErrorBarShape($which_error_type);
$graph->SetXAxisPosition($which_xap);
$graph->SetYAxisPosition($which_yap);
$graph->SetPlotBorderType($which_btype);
示例9: 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();
}
}
}
示例10:
if ($stat['ytitle']) {
$graph->SetYTitle($stat['ytitle'], 'plotleft');
}
// plotleft, plotright, both, plotin, none
// 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');
示例11: array
require_once 'phplot.php';
# Notes: You can't have both X tick and data labels on, because if
# 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]) {
示例12:
# Uncomment this and the require above for tracing:
#$p->SetCallback('debug_scale', 'debug_handler');
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotBorderType('full');
$p->SetPlotAreaWorld($x0, $y0, $x1, $y1);
if ($tp['do_title']) {
$p->SetTitle($tp['title'] . $tp['suffix']);
}
$p->SetXDataLabelPos('none');
$p->SetXTitle($x_title, $tp['x_title_pos']);
$p->SetYTitle($y_title, $tp['y_title_pos']);
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(10);
if (isset($tp['xdatalabel'])) {
$p->SetXTickLabelPos('none');
$p->SetXDataLabelPos($tp['xdatalabel']);
} else {
$p->SetXTickLabelPos($tp['xticklabel']);
}
if (isset($tp['xtick'])) {
$p->SetXTickPos($tp['xtick']);
} else {
$p->SetXTickPos($tp['xticklabel']);
}
$p->SetYTickLabelPos($tp['yticklabel']);
if (isset($tp['ytick'])) {
$p->SetYTickPos($tp['ytick']);
} else {
$p->SetYTickPos($tp['yticklabel']);
}
示例13: 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>";
}
示例14: 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();
示例15: graficarDemandaPronosticoError
function graficarDemandaPronosticoError($oData)
{
$sql = "select\r\n\t\t\t\tdate_format(c1.fecha_fin, '%d/%m/%Y') fecha_fin, \r\n\t\t\t\tcantidad_demandada, \r\n\t\t\t\tprediccion, \r\n\t\t\t\terror,\r\n\t\t\t\tsenial \r\n\t\t\t\tfrom (\r\n\t\t\t\t\tselect\r\n\t\t\t\t\tfecha_fin, \r\n\t\t\t\t\tcantidad_demandada, \r\n\t\t\t\t\tprediccion, \r\n\t\t\t\t\terror, \r\n\t\t\t\t\tsenial \r\n\t\t\t\t\tfrom predicciones t1 \r\n\t\t\t\t\tinner join periodos t2 on t1.id_periodo = t2.id_periodo \r\n\t\t\t\t\twhere id_producto= " . $oData["id_producto"] . " \r\n\t\t\t\t\torder by fecha_fin asc) c1";
$rs = getRS($sql);
$data = array();
$nro = getNrosRows($rs);
$flag = 1;
if ($nro) {
while ($row = getRow($rs)) {
if ($flag) {
$inicio = $row['fecha_fin'];
$flag = 0;
}
$nro--;
if ($nro == 0) {
$fin = $row['fecha_fin'];
}
$data[] = array('', $row['cantidad_demandada'], $row['prediccion'], $row['error'], $row['senial']);
}
}
$plot = new PHPlot(800, 465);
//$plot->SetImageBorderType('plain');
$plot->SetPlotType('lines');
//tipo de gráfico
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
$plot->SetTitle('Demanda real, predicción, error y señal de rastreo. Periodo ' . $inicio . ' al ' . $fin);
//Título
$plot->SetLegend(array('Demanda real', 'Pronóstico', 'Error', 'Señal de rastreo'));
//Referencia
$plot->SetLineWidths(2);
//ancho de la linea
$plot->SetLineStyles("solid");
//estilo de la linea
$plot->SetDataColors(array('green', 'blue', 'red', 'purple'));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
# Draw both grids:
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
$plot->DrawGraph();
}