本文整理汇总了PHP中PHPlot::SetFontTTF方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetFontTTF方法的具体用法?PHP PHPlot::SetFontTTF怎么用?PHP PHPlot::SetFontTTF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetFontTTF方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: font
<?php
# $Id$
# Testing phplot - Default TT font (3b): Set font with file basename only
require_once 'phplot.php';
require_once 'config.php';
// TTF setup
$data = array(array('A', 3, 6), array('B', 2, 4), array('C', 1, 2));
$p = new PHPlot(800, 800);
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotType('bars');
$p->SetTitle("SetFontTTF() with file basename only");
$p->SetXTitle('X Axis Title');
$p->SetYTitle('Y Axis Title');
$p->SetFontTTF('title', $phplot_test_ttfonts['serifbold'], 18);
$p->SetFontTTF('x_title', $phplot_test_ttfonts['serifitalic'], 14);
$p->SetFontTTF('y_title', $phplot_test_ttfonts['serifbolditalic'], 10);
$p->DrawGraph();
fwrite(STDERR, "OK defaultfont3b: title font=" . $p->fonts['title']['font'] . "\n");
示例2: guifi_stats_chart07
function guifi_stats_chart07()
{
include drupal_get_path('module', 'guifi') . '/contrib/phplot/phplot.php';
$gDirTTFfonts = drupal_get_path('module', 'guifi') . '/contrib/fonts/';
if (isset($_GET['width'])) {
$gwidth = $_GET['width'];
} else {
$gwidth = 500;
}
if (isset($_GET['height'])) {
$gheight = $_GET['height'];
} else {
$gheight = 450;
}
$today = getdate();
$year = $today[year];
$month = $today[mon];
$month = $month - 12;
$n = 0;
$tot = 0;
if ($month < 1) {
$year = $year - 1;
$month = 12 + $month;
}
$datemin = mktime(0, 0, 0, $month, 1, $year);
if (isset($_GET['zone'])) {
$zone_id = $_GET['zone'];
if ($zone_id == "0") {
$zone_id = "0";
}
//"3671";
} else {
$zone_id = "0";
}
$avalue = array();
$adata = array();
for ($i = 0; $i < 10; $i++) {
$adata[] = array(0, 0);
}
$vsql = "select sum(if(timestamp_created >= " . $datemin . ",1,0)) as num, count(*) as total, zone_id\n from {guifi_location}\n where status_flag='Working' ";
if ($zone_id != "0") {
$achilds = guifi_zone_childs($zone_id);
$v = "";
foreach ($achilds as $key => $child) {
if ($v == "") {
$v .= "zone_id=" . $child;
} else {
$v .= " or zone_id=" . $child;
}
}
$vsql .= "AND (" . $v . ") ";
}
$vsql .= "GROUP BY zone_id ";
$result = db_query($vsql);
while ($record = db_fetch_object($result)) {
if ($record->total >= 20) {
$vn = $record->num / $record->total * 100;
$vmin = 0;
for ($i = 1; $i < 10; $i++) {
if ($adata[$vmin][1] > $adata[$i][1]) {
$vmin = $i;
}
}
if ($vn > $adata[$vmin][1]) {
$adata[$vmin][0] = $record->zone_id;
$adata[$vmin][1] = $vn;
}
}
}
for ($i = 0; $i < 10; $i++) {
if ($adata[$i][1] != 0) {
$avalue[$adata[$i][0]] = $adata[$i][1];
}
}
arsort($avalue);
foreach ($avalue as $key => $value) {
if ($value != 0) {
$data[] = array(substr(guifi_get_zone_name($key), 0, 20) . " �", $value);
}
}
$shapes = array('none');
$plot = new PHPlot($gwidth, $gheight);
$plot->SetPlotAreaWorld(0, 0, NULL, NULL);
$plot->SetFileFormat('png');
$plot->SetDataType("text-data");
$plot->SetDataValues($data);
$plot->SetPlotType("bars");
$plot->SetXTickIncrement(1);
$plot->SetSkipBottomTick(TRUE);
$plot->SetSkipLeftTick(TRUE);
$plot->SetTickLength(0);
//$plot->SetXTickPos('none');
$plot->SetYDataLabelPos('plotin');
$plot->SetYLabelType('data', 0);
$plot->SetTickColor('grey');
$plot->SetTTFPath($gDirTTFfonts);
$plot->SetFontTTF('title', 'Vera.ttf', 12);
$plot->SetFontTTF('x_label', 'Vera.ttf', 8);
if (isset($_GET['title'])) {
$plot->SetTitle("guifi.net \n" . t($_GET['title']));
//.........这里部分代码省略.........
示例3: PHPlot
}
$message = 'DrawMessage() test: ';
if (empty($text)) {
$message .= 'All defaults';
} else {
$message .= $text;
}
if (!empty($extra_chars)) {
$message .= str_repeat(' Test', (int) ($extra_chars / 5));
}
$p = new PHPlot(800, 600);
if (!empty($use_gdfont)) {
$p->SetFontGD('generic', 5);
} elseif (!empty($use_ttfont)) {
$p->SetTTFPath($phplot_test_ttfdir);
$p->SetFontTTF('generic', $phplot_test_ttfonts['serifitalic'], 14);
}
if (!empty($set_bgcolor)) {
$p->SetBackgroundColor('yellow');
}
if (!empty($set_bgimage)) {
$p->SetBgImage('images/bubbles.png', 'tile');
}
if (!empty($set_border)) {
$p->SetImageBorderWidth(3);
$p->SetImageBorderColor('red');
$p->SetImageBorderType('raised');
}
if (!empty($noprint)) {
$p->SetPrintImage(False);
}
示例4: DrawMessage
<?php
# $Id$
# PHPlot Example: Use DrawMessage() to display a message
require_once 'phplot.php';
require_once 'config.php';
// Font info
$plot = new PHPlot(600, 400);
$plot->SetTTFPath($phplot_test_ttfdir);
$plot->SetFontTTF('generic', $phplot_test_ttfonts['sansitalic'], 14);
$plot->SetBackgroundColor('#ffcc99');
$plot->SetImageBorderWidth(8);
$plot->SetImageBorderColor('blue');
$plot->SetImageBorderType('raised');
#
# Here you would start to produce the plot, then detect something wrong ...
#
$message = "I'm sorry, Dave. I'm afraid I can't do that.\n" . "\n" . "You haven't supplied enough data to produce a plot. " . "Please try again at another time.";
$plot->DrawMessage($message, array('draw_background' => TRUE, 'draw_border' => TRUE, 'reset_font' => FALSE, 'wrap_width' => 50, 'text_color' => 'navy'));
示例5:
$p->SetPointShapes($shapes);
$p->SetLineStyles('solid');
$p->SetDataColors(array('red', 'blue', 'green'));
$p->SetLegend($legend);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType($plottype);
$p->SetPlotAreaWorld(0, 0, 5, 10);
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(1.0);
$p->SetYTickIncrement(1.0);
# Option: Use legend shape markers?
$p->SetLegendUseShapes($useshapes);
# Option: Use TT Font, set size and optional line spacing scale:
if (!empty($fontsize)) {
$p->SetFontTTF('legend', $font, $fontsize, $linespacing);
}
# Option: Varying point shape sizes:
if ($setpointsizes) {
$p->SetPointSizes(array(2, 4, 8, 10, 16));
}
# Turn on backgrounds for visibility.
$p->SetBackgroundColor('SkyBlue');
$p->SetDrawPlotAreaBackground(True);
$p->SetPlotBgColor('plum');
# Option: Change alignment of lines/color boxes in legend?
if (isset($textalign)) {
$p->SetLegendStyle($textalign, $colorboxalign);
}
# Opton: Scale factor for color box width?
if (isset($colorboxwidth)) {
示例6: 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();
}
}
}
示例7: DrawMessage
<?php
# PHPlot Example: Use DrawMessage() to display a message
require_once 'phplot.php';
$plot = new PHPlot(600, 400);
# Note: This font name is system dependent:
$plot->SetFontTTF('generic', 'LiberationSans-Italic.ttf', 14);
$plot->SetBackgroundColor('#ffcc99');
$plot->SetImageBorderWidth(8);
$plot->SetImageBorderColor('blue');
$plot->SetImageBorderType('raised');
#
# Here you would start to produce the plot, then detect something wrong ...
#
$message = "I'm sorry, Dave. I'm afraid I can't do that.\n" . "\n" . "You haven't supplied enough data to produce a plot. " . "Please try again at another time.";
$plot->DrawMessage($message, array('draw_background' => TRUE, 'draw_border' => TRUE, 'reset_font' => FALSE, 'wrap_width' => 50, 'text_color' => 'navy'));
示例8: elseif
$data = $data1;
} elseif ($tp['datasign'] < 0) {
$data = $data2;
} else {
$data = array_merge($data1, $data2);
}
$p = new PHPlot(800, 800);
$p->SetTitle($tp['title'] . $tp['suffix']);
$p->SetXTitle('This is the X Axis Title');
$p->SetYTitle('This is the Y Axis Title');
$p->SetDataValues($data);
$p->SetDataType('text-data-yx');
$p->SetPlotType('bars');
$p->SetXDataLabelPos('plotin');
if (isset($tp['shade'])) {
$p->SetShading($tp['shade']);
}
if ($tp['ttf']) {
$p->SetFontTTF('x_label', $phplot_test_ttfdir . $phplot_test_ttfonts['sans'], 10);
}
if ($tp['yaxis0']) {
$p->SetYAxisPosition(0);
}
if (isset($tp['labelangle'])) {
$p->SetXDataLabelAngle($tp['labelangle']);
}
if ($tp['labelformat']) {
$p->SetXDataLabelType('data', 1, '', '%');
}
$p->SetYTickPos('none');
$p->DrawGraph();
示例9: trim
}
$title = trim($t);
# Determine image aspect: 800x800 square, 800x400 landscape, or 400x800 portrait
$width = $image_aspect == 'S' || $image_aspect == 'L' ? 800 : 400;
$height = $image_aspect == 'S' || $image_aspect == 'P' ? 800 : 400;
$plot = new PHPlot($width, $height);
$plot->SetPlotType('pie');
$plot->SetDataType($data_type);
$plot->SetDataValues($data);
if (!empty($plot_margins)) {
call_user_func_array(array($plot, 'SetMarginsPixels'), $plot_margins);
}
# Font setup
if (!empty($ttfonts)) {
if (isset($font_size)) {
$plot->SetFontTTF('generic', $phplot_test_ttfonts['sans'], $font_size);
} else {
$plot->SetFontTTF('generic', $phplot_test_ttfonts['sans']);
}
} elseif (isset($font_size)) {
$plot->SetFontGD('generic', $font_size);
}
$plot->SetTitle($title);
if (!empty($plot_border)) {
$plot->SetPlotBorderType($plot_border);
}
if (isset($pie_diam_factor)) {
$plot->pie_diam_factor = $pie_diam_factor;
}
if (isset($shading)) {
$plot->SetShading($shading);
示例10: font
<?php
# $Id$
# Testing phplot - Default TT font (1b): No default path or font, SetFontTTF
require_once 'phplot.php';
$data = array(array('A', 3, 6), array('B', 2, 4), array('C', 1, 2));
$p = new PHPlot(800, 800);
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotType('bars');
$p->SetTitle("TTF default not set, SetFontTTF() with no fontname\nTitles in 3 sizes");
$p->SetXTitle('X Axis Title');
$p->SetYTitle('Y Axis Title');
$p->SetFontTTF('title', '', 18);
$p->SetFontTTF('x_title', '', 14);
$p->SetFontTTF('y_title', '', 10);
$p->DrawGraph();
fwrite(STDERR, "OK defaultfont1b: title font=" . $p->fonts['title']['font'] . "\n");
示例11: PHPlot
$p = new PHPlot(800, 600);
$p->SetTitle($title . $suffix);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetImageBorderType('solid');
$p->SetYDataLabelPos('plotin');
if (isset($yd_angle)) {
$p->SetYDataLabelAngle($yd_angle);
}
if (isset($y_type)) {
$p->SetYLabelType($y_type, $y_type_arg);
}
if (isset($yd_type)) {
$p->SetYDataLabelType($yd_type, $yd_type_arg);
}
if (isset($y_label_font)) {
if (isset($y_label_font_ttfsize)) {
$p->SetFontTTF('y_label', $y_label_font, $y_label_font_ttfsize);
} else {
$p->SetFontGD('y_label', $y_label_font);
}
}
$p->SetXLabelType('data', 3);
$p->SetPlotType($plot_type);
if (isset($dvl_angle)) {
$p->data_value_label_angle = $dvl_angle;
}
if (isset($dvl_dist)) {
$p->data_value_label_distance = $dvl_dist;
}
$p->DrawGraph();
示例12: array
}
# Make a data array with equal-size slices:
$data = array_fill(0, $pie_slices, array('', 1));
$plot = new PHPlot(800, 600);
$plot->SetDataValues($data);
$plot->SetDataType('text-data-single');
$plot->SetPlotType('pie');
$plot->SetShading(0);
$plot->SetImageBorderType('plain');
$plot->SetPrintImage(False);
$plot->SetTitle("Pie Chart - Vary Start Angle and Direction\n" . "(CW = Clockwise, CCW = Counter-clockwise)");
# Configure pie labels: Show sector index, inside the pie, in a large font.
$plot->SetPieLabelType('index');
$plot->SetLabelScalePosition(0.25);
# Use the default TrueType font at 36 points.
$plot->SetFontTTF('generic', '', 36);
# This font is used by the callback to label each plot:
# Use the default TrueType font at 16 points.
$plot->SetFontTTF('x_title', '', 16);
// Use the default TTF font at 16 pts
# Draw the plot tiles:
draw_plot($plot, $base_angle + 0, 'CCW', 0, 50);
draw_plot($plot, $base_angle + 90, 'CCW', 200, 50);
draw_plot($plot, $base_angle + 180, 'CCW', 400, 50);
draw_plot($plot, $base_angle + 270, 'CCW', 600, 50);
draw_plot($plot, $base_angle + 0, 'CW', 0, 300);
draw_plot($plot, $base_angle + 90, 'CW', 200, 300);
draw_plot($plot, $base_angle + 180, 'CW', 400, 300);
draw_plot($plot, $base_angle + 270, 'CW', 600, 300);
# Done:
$plot->PrintImage();
示例13: 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();
}
}
}
示例14: array
// Import test parameters
$data = array(array('', 0, 0, 0, 0), array('', 1, 1, 2, 3), array('', 2, 2, 4, 6), array('', 3, 3, 6, 9));
$legend = array('Plot Line 1', 'Longer label for Plot Line 2', 'line 3');
$p = new PHPlot(800, 600);
if (!empty($title)) {
// $title can be set empty for special case
if (!empty($suffix)) {
$title .= "\n" . $suffix;
}
$p->SetTitle($title);
}
// Use smaller window, offset, so legend position is more apparent.
$p->SetPlotAreaPixels(100, 80, 700, 480);
$p->SetLegend($legend);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType('lines');
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(1.0);
$p->SetYTickIncrement(1.0);
$p->SetDrawXGrid(True);
if (isset($ttfontsize)) {
$p->SetFontTTF('legend', $font, $ttfontsize, $ttlinespace);
}
if (isset($relto)) {
$p->SetLegendPosition($lx, $ly, $relto, $bx, $by, $ox, $oy);
}
if (isset($callback)) {
call_user_func($callback, $p);
}
$p->DrawGraph();
示例15: font
<?php
# $Id$
# Testing phplot - Default TT font (2b): Local path and named font.
# This test requires a specific font (see TEST_FONT) be present in the images/
# directory. The listed font is redistributable under the Open Fonts License.
require_once 'phplot.php';
define('TEST_FONT', 'FreeUniversal-Regular.ttf');
$data = array(array('A', 3, 6), array('B', 2, 4), array('C', 1, 2));
$p = new PHPlot(800, 800);
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotType('bars');
$p->SetTitle('Local TTF path and SetFontTTF with file basename only');
$p->SetXTitle('X Axis Title');
$p->SetYTitle('Y Axis Title');
$p->SetTTFPath(getcwd() . DIRECTORY_SEPARATOR . 'images');
$p->SetFontTTF('title', TEST_FONT, 18);
$p->SetFontTTF('x_title', TEST_FONT, 14);
$p->SetFontTTF('y_title', TEST_FONT, 10);
$p->DrawGraph();
fwrite(STDERR, "OK defaultfont2b: title font=" . $p->fonts['title']['font'] . "\n");