本文整理汇总了PHP中PHPlot::SetXTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetXTitle方法的具体用法?PHP PHPlot::SetXTitle怎么用?PHP PHPlot::SetXTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetXTitle方法的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: renderLot
public function renderLot()
{
$grafico = new PHPlot(800, 600);
$grafico->SetFileFormat("jpg");
$grafico->SetIsInline(True);
#Indicamos o títul do gráfico e o título dos dados no eixo X e Y do mesmo
$grafico->SetTitle($this->data->titulo);
$grafico->SetXTitle($this->data->eixoX);
$grafico->SetYTitle($this->data->eixoY);
#passamos o tipo de gráfico escolhido
if (!$this->data->tipoLot) {
$this->data->tipoLot = 'bars';
}
$grafico->SetPlotType($this->data->tipoLot);
switch ($this->data->tipoLot) {
case 'pie':
$grafico->SetPieLabelType('index', 'custom', 'mycallback');
$grafico->SetDataType('text-data-single');
break;
case 'stackedbars':
$grafico->SetDataType('text-data-yx');
break;
case 'bubbles':
$grafico->SetDataType('data-data-xyz');
break;
}
$grafico->SetLegend($column_names);
#Definimos os dados do gráfico
switch ($this->data->tipoLot) {
case 'pie':
$dados = array(array($this->data->x1, $this->data->y11), array($this->data->x2, $this->data->y21), array($this->data->x3, $this->data->y31), array($this->data->x4, $this->data->y41));
break;
default:
$dados = array(array($this->data->x1, $this->data->y11, $this->data->y12, $this->data->y13), array($this->data->x2, $this->data->y21, $this->data->y22, $this->data->y23), array($this->data->x3, $this->data->y31, $this->data->y32, $this->data->y33), array($this->data->x4, $this->data->y41, $this->data->y42, $this->data->y43));
break;
}
$grafico->SetDataValues($dados);
#Salvamos o gráfico
$caminho = \Manager::getFilesPath();
$fileName = uniqid() . '.jpg';
$grafico->SetOutputFile($caminho . '/' . $fileName);
$grafico->SetIsInline(True);
$grafico->DrawGraph();
#obtemos o endereco do grafico
$this->data->locate = \Manager::getDownloadURL('files', basename($fileName), true);
}
示例4: 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;
}
示例5: 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();
示例6: array
function servicios_años($param, $año_inicial, $año_final)
{
$this->autoLayout = false;
$this->autoRender = false;
$total_solicitudes = 0;
// Obtenemos los años existentes, segun el parámetro de configuración.
$param_año = '';
if ($param == 'rango') {
if ($año_inicial == $año_final) {
$años[] = array(array('year' => $año_inicial));
} else {
$param_año = 'AND YEAR(solucionada)>= ' . $año_inicial . ' AND YEAR(solucionada)<= ' . $año_final;
}
}
if (!isset($años)) {
$años = $this->Solicitud->query("SELECT YEAR(solucionada) AS year FROM solicitudes WHERE estado='s' " . $param_año . " GROUP BY YEAR(solucionada)");
}
if (!empty($años)) {
$total = array();
foreach ($años as $año) {
//$cantidad_solicitudes = $this->Solicitud->query("SELECT tipo_servicio, COUNT(*) AS cuenta FROM solicitudes WHERE estado='s' AND YEAR(solucionada)=".$año[0]['year']);
$cantidad_solicitudes = $this->Solicitud->query("SELECT tipo_servicio FROM solicitudes WHERE estado='s' AND YEAR(solucionada)=" . $año[0]['year']);
// Recreamos el arreglo de cant_solicitudes
$cuentas = array('1' => 0, '2' => 0, '3' => 0);
foreach ($cantidad_solicitudes as $cant_tipo_solicitud) {
$ts = split(',', $cant_tipo_solicitud['solicitudes']['tipo_servicio']);
for ($i = 0; $i < count($ts); $i++) {
switch ($ts[$i]) {
case '1':
++$cuentas[1];
break;
case '2':
++$cuentas[2];
break;
case '3':
++$cuentas[3];
break;
}
}
}
for ($i = 0; $i < 3; $i++) {
$cant_solicitudes[$i] = array('solicitudes' => array('tipo_servicio' => $i + 1), 0 => array('cuenta' => $cuentas[$i + 1]));
}
$total[$año[0]['year']] = $cant_solicitudes;
for ($j = 0; $j < count($cant_solicitudes); $j++) {
$total_solicitudes += $cant_solicitudes[$j][0]['cuenta'];
}
}
if (!empty($total)) {
$arreglo_plot = array();
foreach ($total as $año => $arreglo_año) {
// se construye el array para el PHPlot.
$ts_1 = $ts_2 = $ts_3 = 0;
for ($i = 0; $i < count($arreglo_año); $i++) {
switch ($arreglo_año[$i]['solicitudes']['tipo_servicio']) {
case '1':
$ts_1 = $arreglo_año[$i][0]['cuenta'];
break;
case '2':
$ts_2 = $arreglo_año[$i][0]['cuenta'];
break;
case '3':
$ts_3 = $arreglo_año[$i][0]['cuenta'];
break;
}
}
$arreglo_plot[] = array($año, $ts_1, $ts_2, $ts_3);
}
$plot = new PHPlot();
$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);
$plot->SetFontTTF('x_title', 'FreeSans.ttf', 12);
// Titulos
$plot->SetTitle("\nSolicitudes de\nservicio por años\nTOTAL: " . $total_solicitudes);
$plot->SetXTitle('AÑOS');
$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('Mantenimiento Preventivo', 'Mantenimiento Correctivo', 'Calibraciones/Certificados');
$plot->SetLegend($leyenda);
$plot->SetLegendPixels(414, 0);
$plot->SetDataColors(array('beige', 'YellowGreen', 'SkyBlue'));
$plot->SetPlotType('bars');
$plot->SetShading(7);
$plot->DrawGraph();
}
}
//.........这里部分代码省略.........
示例7: array
<?php
# PHPlot Example - Horizontal Stacked Bars
require_once 'phplot.php';
$column_names = array('Beef', 'Fish', 'Pork', 'Chicken', 'Butter', 'Cheese', 'Ice Cream');
// | | | | | | |
$data = array(array('1910', 48.5, 11.2, 38.2, 11.0, 18.4, 3.9, 1.9), array('1930', 33.7, 10.2, 41.1, 11.1, 17.6, 4.7, 9.699999999999999), array('1950', 44.6, 11.9, 43.0, 14.3, 10.9, 7.7, 17.4), array('1970', 79.59999999999999, 11.7, 48.1, 27.4, 5.4, 11.4, 17.8), array('1990', 63.9, 14.9, 46.4, 42.4, 4.0, 24.6, 15.8));
$plot = new PHPlot(800, 500);
$plot->SetImageBorderType('plain');
// Improves presentation in the manual
$plot->SetTitle("U.S. Annual Per-Capita Consumption\n" . "of Selected Meat and Dairy Products");
$plot->SetLegend($column_names);
# Move the legend to the lower right of the plot area:
$plot->SetLegendPixels(700, 300);
$plot->SetDataValues($data);
$plot->SetDataType('text-data-yx');
$plot->SetPlotType('stackedbars');
$plot->SetXTitle('Pounds Consumed Per Capita');
# Show data value labels:
$plot->SetXDataLabelPos('plotstack');
# Rotate data value labels to 90 degrees:
$plot->SetXDataLabelAngle(90);
# Format the data value labels with 1 decimal place:
$plot->SetXDataLabelType('data', 1);
# Specify a whole number for the X tick interval:
$plot->SetXTickIncrement(20);
# Disable the Y tick marks:
$plot->SetYTickPos('none');
$plot->DrawGraph();
示例8: array
# Explicit X or Y, no error bars
$data = array(array('A', 0, 0, 0), array('B', 1, 1, 2), array('H', 7, 7, 14), array('D', 3, 3, 6), array('F', 5, 5, 10), array('C', 2, 2, 4), array('G', 6, 6, 12), array('E', 4, 4, 8));
} elseif (!$implied_x && $error_bars) {
# Explicit X, error bars
$data = array(array('A', 0, 0, 1, 0, 0, 0, 0), array('B', 1, 1, 1, 1, 2, 1, 1), array('H', 7, 7, 1, 1, 14, 1, 1), array('D', 3, 3, 1, 0, 6, 0, 0), array('F', 5, 5, 1, 1, 10, 1, 0), array('C', 2, 2, 0, 1, 4, 1, 1), array('G', 6, 6, 1, 1, 12, 0, 1), array('E', 4, 4, 0, 0, 8, 1, 1));
} else {
fwrite(STDERR, "Error: Unknown data type or not decoded: {$data}-type\n");
exit(1);
}
$p = new PHPlot(800, 800);
$p->SetTitle("Testing PHPlot ({$plot_type}, {$data_type})");
$p->SetDataType($data_type);
$p->SetDataValues($data);
$p->SetPlotType($plot_type);
if ($horizontal) {
$p->SetXTitle('X Axis - Dependent variable');
$p->SetYTitle('Y Axis - Independent variable');
$p->SetXDataLabelPos('plotin');
// Tick labels left, Axis Data labels right, so both can be seen.
$p->SetYTickLabelPos('plotleft');
$p->SetYDataLabelPos('plotright');
} else {
$p->SetXTitle('X Axis - Independent variable');
$p->SetYTitle('Y Axis - Dependent variable');
$p->SetYDataLabelPos('plotin');
// Tick labels below, Axis Data labels above, so both can be seen.
$p->SetXTickLabelPos('plotdown');
$p->SetXDataLabelPos('plotup');
}
# Customizations for error plots:
if ($error_bars) {
示例9: elseif
$WhereClause .= " salesperson='" . $_POST['SalesmanCode'] . "' AND";
}
if ($_POST['GraphOn'] == 'Customer') {
$GraphTitle .= ' ' . _('For Customers from') . ' ' . $_POST['ValueFrom'] . ' ' . _('to') . ' ' . $_POST['ValueTo'];
$WhereClause .= " cust >='" . $_POST['ValueFrom'] . "' AND cust <='" . $_POST['ValueTo'] . "' AND";
}
if ($_POST['GraphOn'] == 'StockID') {
$GraphTitle .= ' ' . _('For Items from') . ' ' . $_POST['ValueFrom'] . ' ' . _('to') . ' ' . $_POST['ValueTo'];
$WhereClause .= " stockid >='" . $_POST['ValueFrom'] . "' AND stockid <='" . $_POST['ValueTo'] . "' AND";
}
$WhereClause = "WHERE " . $WhereClause . " salesanalysis.periodno>='" . $_POST['FromPeriod'] . "' AND salesanalysis.periodno <= '" . $_POST['ToPeriod'] . "'";
$SQL = "SELECT salesanalysis.periodno,\n\t\t\t\tperiods.lastdate_in_period,\n\t\t\t\tSUM(CASE WHEN budgetoractual=1 THEN " . $SelectClause . " ELSE 0 END) AS sales,\n\t\t\t\tSUM(CASE WHEN budgetoractual=0 THEN " . $SelectClause . " ELSE 0 END) AS budget\n\t\tFROM salesanalysis INNER JOIN periods ON salesanalysis.periodno=periods.periodno " . $WhereClause . "\n\t\tGROUP BY salesanalysis.periodno,\n\t\t\tperiods.lastdate_in_period\n\t\tORDER BY salesanalysis.periodno";
$graph->SetTitle($GraphTitle);
$graph->SetTitleColor('blue');
$graph->SetOutputFile('companies/' . $_SESSION['DatabaseName'] . '/reports/salesgraph.png');
$graph->SetXTitle(_('Month'));
if ($_POST['GraphValue'] == 'Net') {
$graph->SetYTitle(_('Sales Value'));
} elseif ($_POST['GraphValue'] == 'GP') {
$graph->SetYTitle(_('Gross Profit'));
} else {
$graph->SetYTitle(_('Quantity'));
}
$graph->SetXTickPos('none');
$graph->SetXTickLabelPos('none');
$graph->SetBackgroundColor('white');
$graph->SetTitleColor('blue');
$graph->SetFileFormat('png');
$graph->SetPlotType($_POST['GraphType']);
$graph->SetIsInline('1');
$graph->SetShading(5);
示例10: 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();
示例11: colors
<?php
# $Id$
# Testing phplot - Title Colors. Case 1 - 3 different colors (main, X, Y)
# Other scripts can set $c1, $c2, and/or $c3 to a color or NULL to set the
# main, X, and/or Y titles, then include this script.
require_once 'phplot.php';
if (empty($c1) && empty($c2) && empty($c3)) {
$c1 = 'red';
$c2 = 'blue';
$c3 = 'green';
}
$subtitle = 'Main: ' . (empty($c1) ? 'default' : $c1) . ', X: ' . (empty($c2) ? 'default' : $c2) . ', Y: ' . (empty($c3) ? 'default' : $c3);
$data = array(array('A', 0), array('B', 1), array('C', 2));
$p = new PHPlot(600, 600);
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotType('bars');
$p->SetTitle("Title color test\n{$subtitle}");
$p->SetXTitle("Title color test - X title", 'both');
$p->SetYTitle("Title color test - Y title", 'both');
if (!empty($c1)) {
$p->SetTitleColor($c1);
}
if (!empty($c2)) {
$p->SetXTitleColor($c2);
}
if (!empty($c3)) {
$p->SetYTitleColor($c3);
}
$p->DrawGraph();
示例12: array
# This is a cubic equation with roots at -8, 2, 10
for ($x = -10; $x <= 10; $x++) {
$data[] = array('', $x, ($x + 8) * ($x - 2) * ($x - 10));
}
$p = new PHPlot(400, 800);
$p->SetPrintImage(FALSE);
$p->SetPlotBorderType('full');
$p->SetTitle("Set/Reset Parameters Test (2)\n" . "Top: Parameters Set\n" . "Bottom: Parameters Reset");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType('lines');
$p->SetLegend('Y = F(X)');
$p->SetLegendPixels(100, 200);
$p->SetNumXTicks(5);
$p->SetNumYTicks(8);
$p->SetXTitle('X Axis with 5 ticks');
$p->SetYTitle('Y Axis with 8 ticks');
$p->SetXAxisPosition(-228);
$p->SetYAxisPosition(7);
$p->SetPlotAreaPixels(70, 80, 380, 400);
$p->DrawGraph();
$p->SetLegendPixels();
$p->SetNumXTicks();
$p->SetNumYTicks();
$p->SetXTitle('X Axis');
$p->SetYTitle('Y Axis');
$p->SetXAxisPosition();
$p->SetYAxisPosition();
$p->SetPlotAreaPixels(70, 450, 380, 750);
$p->DrawGraph();
$p->PrintImage();
示例13: array
<?php
# Typical bars with labels, for manual.
require_once 'phplot.php';
$data = array(array('First', 10), array('Second', 20), array('Third', 30));
$p = new PHPlot(400, 300);
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotType('bars');
$p->SetTitle('Vertical Bar Plot With Labels');
$p->SetXTitle('Independent Variable');
$p->SetYTitle('Dependent Variable');
$p->SetXDataLabelPos('plotdown');
$p->SetXTickPos('none');
$p->SetYDataLabelPos('plotin');
$p->SetPlotAreaWorld(NULL, 0, NULL, 40);
$p->SetYTickIncrement(5);
$p->SetImageBorderType('plain');
$p->DrawGraph();
示例14: guifi_stats_chart05
//.........这里部分代码省略.........
} else {
$tot = $record->num;
}
$tot2 = fmediacalc($tot, $datos, $n, $nmonths);
$data[] = array("{$label}", $nreg, $tot2);
if (floor($tot2) > $max) {
$max = floor($tot2);
}
if ($mes == 12) {
$mes = 1;
$ano++;
} else {
$mes++;
}
}
$tot += $record->num;
$nreg++;
if ($mes == 6) {
$label = $ano;
} else {
$label = '';
}
if ($n == 0) {
$tot += $record->num;
} else {
$tot = $record->num;
}
$tot2 = fmediacalc($tot, $datos, $n, $nmonths);
$data[] = array("{$label}", $nreg, $tot2);
if (floor($tot2) > $max) {
$max = floor($tot2);
}
} else {
$tot += $record->num;
}
}
while ($mes < 12) {
$nreg++;
$mes++;
if ($mes == 6) {
$label = $ano;
} else {
$label = '';
}
$data[] = array("{$label}", $nreg, "");
}
if ($tot <= 10) {
$inc = 1;
} else {
$vlen = strlen($max);
$vini = substr($max, 0, 1);
$inc = str_pad($vini, $vlen - 1, "0");
}
$items = ($ano - $items + 1) * 12;
$shapes = array('none');
$plot = new PHPlot($gwidth, $gheight);
$plot->SetPlotAreaWorld(0, 0, $items, NULL);
$plot->SetFileFormat('png');
$plot->SetDataType("data-data");
$plot->SetDataValues($data);
$plot->SetPlotType("linepoints");
$plot->SetYTickIncrement($inc);
$plot->SetXTickIncrement(12);
$plot->SetSkipBottomTick(TRUE);
$plot->SetSkipLeftTick(TRUE);
$plot->SetXAxisPosition(0);
$plot->SetPointShapes($shapes);
$plot->SetPointSizes(10);
$plot->SetTickLength(3);
$plot->SetDrawXGrid(TRUE);
$plot->SetTickColor('grey');
$plot->SetTTFPath($gDirTTFfonts);
$plot->SetFontTTF('title', 'Vera.ttf', 12);
if (isset($_GET['title'])) {
$plot->SetTitle("guifi.net \n" . t($_GET['title']));
} else {
if ($zone_id == "0") {
$plot->SetTitle("guifi.net \n" . t('Nodes per month, ' . "{$nmonths}" . ' months average'));
} else {
$plot->SetTitle("guifi.net " . t('zone') . ": " . guifi_get_zone_name($zone_id) . "\n" . t('Nodes per month, ' . "{$nmonths}" . ' months average'));
}
}
$plot->SetXTitle(t('Years'));
$plot->SetYTitle(t('Working nodes'));
$plot->SetDrawXDataLabelLines(FALSE);
$plot->SetXLabelAngle(0);
$plot->SetXLabelType('custom', 'guifi_stats_chart05_LabelFormat');
$plot->SetGridColor('red');
$plot->SetPlotBorderType('left');
$plot->SetDataColors(array('orange'));
$plot->SetTextColor('DimGrey');
$plot->SetTitleColor('DimGrey');
$plot->SetLightGridColor('grey');
$plot->SetBackgroundColor('white');
$plot->SetTransparentColor('white');
$plot->SetXTickLabelPos('none');
$plot->SetXDataLabelPos('plotdown');
$plot->SetIsInline(TRUE);
$plot->DrawGraph();
}
示例15: array
<?php
# $Id$
# PHPlot bug 1813071: Wrong title height for multi-line TTF text
# Note: This overlaps the title_text* tests somewhat, but with more fonts.
require_once 'phplot.php';
require 'config.php';
# Font info
$data = array(array('A', -3, 6), array('B', -2, 4), array('C', -1, 2), array('D', 0, 0), array('E', 1, -2), array('F', 2, -4), array('G', 3, -6));
$p = new PHPlot(800, 800);
$p->SetTTFPath($phplot_test_ttfdir);
$p->SetDefaultTTFont($phplot_test_ttfonts['sans']);
$p->SetFont('title', $phplot_test_ttfonts['serifbolditalic'], 14);
$p->SetFont('x_title', $phplot_test_ttfonts['sansbold'], 10);
$p->SetFont('y_title', $phplot_test_ttfonts['serifbold'], 10);
$p->SetTitle("TrueType Text Title\nLine 2 of title\nLine 3 of title\nLine 4");
$p->SetXTitle("X Axis Tile\nLine 2\nLine 3\nLine 4");
$p->SetYTitle("Y Axis Tile\nLine 2\nLine 3\nLine 4");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(1.0);
$p->SetYTickIncrement(1.0);
$p->SetPlotType('lines');
$p->DrawGraph();