本文整理汇总了PHP中PHPlot::SetFont方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPlot::SetFont方法的具体用法?PHP PHPlot::SetFont怎么用?PHP PHPlot::SetFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPlot
的用法示例。
在下文中一共展示了PHPlot::SetFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BuatPieGraph
function BuatPieGraph($filetujuan, $prevtahun, $tahun, $urutan, $gel)
{
$fg = GetaField("pmb b left outer join pmbperiod p on b.PMBPeriodID=p.PMBPeriodID and b.KodeID=p.KodeID and LEFT(p.PMBPeriodID, 4)='{$tahun}'", "(b.TahunLulus='{$prevtahun}' or b.TahunLulus='{$tahun}') and b.KodeID", KodeID, "count(b.PMBID)");
$nfg = GetaField("pmb b left outer join pmbperiod p on b.PMBPeriodID=p.PMBPeriodID and b.KodeID=p.KodeID and LEFT(p.PMBPeriodID, 4)='{$tahun}'", "b.TahunLulus < '{$prevtahun}' and b.KodeID", KodeID, "count(b.PMBID)");
$data = array(array('Fresh Graduate', $fg), array('Non Fresh Graduate', $nfg));
$plot = new PHPlot(800, 600);
//$plot->SetImageBorderType('raised');
$plot->SetPlotType('pie');
$plot->SetDataType('text-data-single');
$plot->SetDataValues($data);
$plot->SetDataColors(array('red', 'blue', 'green', 'yellow', 'cyan', 'magenta', 'brown', 'lavender', 'pink', 'gray', 'orange'));
$plot->setShading(60);
$plot->SetLabelScalePosition(0.2);
$plot->SetFont('generic', 5);
$plot->SetFont('title', 5);
$plot->SetFont('legend', 5);
$plot->SetTitle("Persentase Calon Mahasiswa Fresh / non Fresh Graduate");
foreach ($data as $row) {
$plot->SetLegend(implode(': ', $row));
}
$plot->SetIsInline(true);
$plot->SetOutputFile($filetujuan);
$plot->DrawGraph();
}
示例2: 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();
}
示例3: 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();
示例4: PHPlot
}
$tp = array_merge(array('title' => 'Text Tests', 'suffix' => " (default behavior)", 'use_ttf' => False, 'use_gdf' => False, 'x_label_angle' => NULL, 'y_label_angle' => NULL), $tp);
require_once 'phplot.php';
# Contains font settings:
require 'config.php';
$p = new PHPlot(800, 600);
$data = array(array('A POINT LABEL', 10, 9, 8), array('B POINT LABEL', 20, 19, 18), array('C POINT LABEL', 30, 28, 26));
$p->SetPlotType('bars');
$p->SetDataType('text-data');
$p->SetDataValues($data);
$p->SetPlotBorderType('full');
if ($tp['use_ttf']) {
# Fonts:
$p->SetTTFPath($phplot_test_ttfdir);
$p->SetDefaultTTFont($phplot_test_ttfonts['sans']);
$p->SetFont('legend', $phplot_test_ttfonts['serifitalic'], 10);
$p->SetFont('title', $phplot_test_ttfonts['sansbold'], 20);
$p->SetFont('x_title', '', 12);
$p->SetFont('y_title', '', 12);
$p->SetFont('x_label', '', 12);
$p->SetFont('y_label', '', 12);
$p->SetFont('generic', '', 14);
} elseif ($tp['use_gdf']) {
$p->SetFont('legend', '4');
$p->SetFont('title', '5');
$p->SetFont('x_title', '3');
$p->SetFont('y_title', '3');
$p->SetFont('x_label', '2');
$p->SetFont('y_label', '2');
$p->SetFont('generic', '2');
}
示例5: PHPlot
}
}
$p = new PHPlot(1024, 768);
$p->SetTitle($title . "\n" . $tp['suffix']);
$p->SetDataType($data_type);
$p->SetDataValues($data);
$p->SetPlotType($plot_type);
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(10);
if ($enable_y_data_labels) {
$p->SetYDataLabelPos('plotin');
}
$p->SetPlotAreaWorld(NULL, 0, NULL, 109);
# Use this TrueType font and make labels bigger:
$p->SetDefaultTTFont($phplot_test_ttfdir . $phplot_test_ttfonts['sans']);
$p->SetFont('x_label', '', 10);
$p->SetFont('y_label', '', 10);
# Options: X
if (isset($tp['x_angle'])) {
$p->SetXLabelAngle($tp['x_angle']);
}
if (isset($tp['xd_angle'])) {
$p->SetXDataLabelAngle($tp['xd_angle']);
}
if (isset($tp['x_type'])) {
$p->SetXLabelType($tp['x_type'], $tp['x_type_arg']);
}
if (isset($tp['xd_type'])) {
$p->SetXDataLabelType($tp['xd_type'], $tp['xd_type_arg']);
}
if (isset($tp['xt_pos'])) {
示例6: array
$cumulateddata = array();
$max = 1;
foreach ($stats->getTimestats($term, $REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselectmonthcount']) as $month) {
$bardata[] = array(date('M', mktime(0, 0, 0, $month['m'], 1, 2010)) . "\n" . $month['count'], $month['count']);
if ($month['count'] > $max) {
$max = $month['count'];
}
}
$title = $I18N->Msg('a587_stats_searchterm_timestats_title', empty($term) ? $I18N->Msg('a587_stats_searchterm_timestats_title0_all') : $I18N->Msg('a587_stats_searchterm_timestats_title0_single', $term), intval($_GET['monthcount']));
if (rex_lang_is_utf8()) {
$title = utf8_decode($title);
}
// draw bars
$plot = new PHPlot(700, 240);
$plot->SetImageBorderType('none');
$plot->SetTransparentColor('white');
$plot->SetMarginsPixels(NULL, NULL, 26, NULL);
# Make sure Y axis starts at 0:
$plot->SetPlotAreaWorld(NULL, 0, NULL, NULL);
$len = strlen('' . $max);
$plot->SetYTickIncrement(max(1, ceil($max / pow(10, $len - 1)) * pow(10, $len - 2)));
# Main plot title:
$plot->SetTitle($title);
$plot->SetFont('title', 3);
// draw bars
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($bardata);
$plot->SetDataColors(array('#14568a', '#2c8ce0', '#dfe9e9'));
$plot->SetShading(ceil(48 / $REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselectmonthcount']));
$plot->DrawGraph();
示例7: array
$tp = array_merge(array('title' => 'Bar Chart - Check Label Centering', 'suffix' => "", 'ND' => 4, 'NB' => 1, 'FSize' => 4, 'Shade' => 0), $tp);
require_once 'phplot.php';
# All the labels are A so we can look for centering.
$data = array();
for ($i = 1; $i <= $tp['ND']; $i++) {
$row = array('A');
for ($j = 1; $j <= $tp['NB']; $j++) {
$row[] = $i + $j;
}
$data[] = $row;
}
$plot = new PHPlot(800, 600);
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle($tp['title'] . $tp['suffix']);
# Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
# Make the text font bigger for the labels:
$plot->SetFont('x_label', $tp['FSize']);
# Results may differ with or without shading:
if (isset($tp['Shade'])) {
$plot->SetShading($tp['Shade']);
}
# TESTING:
#$plot->group_frac_width=1.0;
#$plot->bar_width_adjust=0.5;
$plot->DrawGraph();
#fwrite(STDERR, print_r($plot, True));
示例8: array
$tp['text'] = array('Plot Line 1', 'Longer label for Plot Line 2', 'line 3');
}
$p = new PHPlot(800, 600);
if ($tp['use_ttf']) {
$p->SetTTFPath($tp['ttfdir']);
$p->SetDefaultTTFont($tp['ttfont']);
}
# Set line spacing:
if (isset($tp['line_spacing'])) {
$p->SetLineSpacing($tp['line_spacing']);
}
$p->SetTitle($tp['title'] . $tp['suffix']);
# Need to set the font for TTF even if legendfont isn't given, to get the size.
if ($tp['use_ttf']) {
if (isset($tp['legendfont'])) {
$p->SetFont('legend', $tp['legendfont'], $tp['ttfsize']);
} else {
$p->SetFont('legend', $tp['ttfont'], $tp['ttfsize']);
}
} elseif (isset($tp['legendfont'])) {
$p->SetFont('legend', $tp['legendfont']);
}
$p->SetLegend($tp['text']);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType('lines');
$p->SetXDataLabelPos('none');
$p->SetXTickIncrement(1.0);
$p->SetYTickIncrement(1.0);
if (isset($tp['textalign'])) {
if (isset($tp['colorboxalign'])) {
示例9: array
// text-data | text-data-yz
# Driver array: key => method, and color:
$cfg = array('text' => array('method' => 'SetTextColor', 'color' => 'red'), 'ticklabel' => array('method' => 'SetTickLabelColor', 'color' => 'DarkGreen'), 'datalabel' => array('method' => 'SetDataLabelColor', 'color' => 'purple'), 'datavaluelabel' => array('method' => 'SetDataValueLabelColor', 'color' => 'peru'));
$data = array(array('A', 1, 2, 3, 4), array('B', 2, 3, 4, 5), array('C', 3, 4, 5, 6));
$plot = new PHPlot(800, 600);
$plot->SetDataType($data_type);
$plot->SetDataValues($data);
$plot->SetPlotType($plot_type);
$plot->SetXTitle('X Axis Title Here');
$plot->SetYTitle('Y Axis Title Here');
// Change all 3 title colors to show the change in data value
// labels, which used title color incorrectly through 5.6.0
$plot->SetTitleColor('grey');
$plot->SetXTitleColor('SlateBlue');
$plot->SetYTitleColor('gold');
$plot->SetFont('x_label', '5');
$plot->SetFont('y_label', '5');
$plot->SetFont('x_title', '5');
$plot->SetFont('y_title', '5');
$plot->SetLegend(array('A', 'B', 'C'));
# Turn off ticks on independent axis, and turn on data value labels. This
# depends on the plot type and data type (horizontal or vertical):
$label_pos = $plot_type == 'stackedbars' ? 'plotstack' : 'plotin';
if ($data_type == 'text-data-yx') {
// Horizontal plot
$plot->SetYTickPos('none');
$plot->SetXDataLabelPos($label_pos);
} else {
// Vertical plot
$plot->SetXTickPos('none');
$plot->SetYDataLabelPos($label_pos);
示例10: array
<?php
# $Id$
# Dual text types: GD and TTF, default TTF, GD X and Y titles
# This requires PHPlot > 5.0.5
require_once 'phplot.php';
# TTF Font info is in this configuration file:
require 'config.php';
$data = array(array('', 0, 0, 0), array('', 10, 5, 10));
$p = new PHPlot(800, 600);
$p->SetTitle("Dual Text Types:\nDefault TTF, TTF title");
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetXTitle('Title of X Data, GD Font 5');
$p->SetYTitle('Title of Y Data, GD Font 3');
$p->SetTTFPath($phplot_test_ttfdir);
$p->SetDefaultTTFont($phplot_test_ttfonts['serifitalic']);
$p->SetFont('title', $phplot_test_ttfonts['serifbold'], 36);
$p->SetFontGD('x_title', 5);
$p->SetFontGD('y_title', 3);
$p->SetXDataLabelPos('none');
$p->SetLegend(array("Legend Line 1", "Legend Line 2"));
$p->SetXTickIncrement(1.0);
$p->SetYTickIncrement(1.0);
# Draw both grids:
$p->SetDrawXGrid(True);
$p->SetDrawYGrid(True);
$p->SetPlotType('lines');
$p->DrawGraph();
示例11: PHPlot
$plot->SetXTickPos('none');
//Draw it
$plot->SetPrintImage(false);
$plot->DrawGraph();
?>
<img src="<?php
echo $plot->EncodeImage();
?>
" style="width:46%;height:350px;display:inline-block;float:left;">
<?php
$plot = new PHPlot();
$data = $stateSalesArray;
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('none');
$plot->SetPlotType('bars');
$plot->SetFont('x_label', 4, 3);
$plot->SetFont('y_label', 4, 3);
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
$plot->SetDataColors("#ffbb33");
# Main plot title:
$plot->SetTitle('State Wise Report');
# Make a legend for the 3 data sets plotted:
$plot->SetLegend(array('Total Amount (INR)'));
# Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
//Draw it
$plot->SetPrintImage(false);
$plot->DrawGraph();
?>
示例12: array
<?php
# $Id$
# PHPlot error test: bug 1446523, part 2 only: No data array
require_once 'phplot.php';
$data = array(array('', 0, 0), array('', 1, 1), array('', 2, 8));
$p = new PHPlot();
$p->SetTitle('Bugcheck: No data');
$p->SetDataType('data-data');
# DON'T:
#$p->SetDataValues($data);
$p->SetFont('x_label', 2);
$p->SetFont('y_label', 2);
$p->SetPlotType('lines');
$p->DrawGraph();
示例13: drawtext
$plural = 's';
}
# Font setup:
# For PHPlot-5.0.5 and earlier, this would directly set its own font[] array
# with members that we knew PHPlot drawtext() uses. But this changed after
# PHPlot-5.0.5, when mixed text types are supported. The goal now is to use
# PHPlot's own SetFont() methods to set up the array, then peak inside to
# see whether it is the old one or new one font array name, and copy it out.
#
if ($tp['use_ttf']) {
# Setup for TrueType fonts:
$fsize = $tp['ttfsize'];
$p->SetTTFPath($tp['ttfdir']);
$p->SetDefaultTTFont($tp['ttfont']);
$title = "TrueType text, {$nlines} line{$plural}, {$fsize} points, at {$angle} degrees";
$p->SetFont('generic', '', $fsize);
} else {
# Setup for GD fonts:
$fsize = $tp['gd_font_size'];
$title = "GD Text, {$nlines} line{$plural}, size {$fsize}, at {$angle} degrees";
$p->SetFont('generic', $fsize);
}
# Now grab the font array, checking for old vs new name:
if (isset($p->generic_font)) {
$font = $p->generic_font;
} elseif (isset($p->fonts['generic'])) {
$font = $p->fonts['generic'];
} else {
die("drawtext.php failure: Unable to determine font class variable name\n");
}
# Assign colors:
示例14: implode
$mode = 'Data';
}
// E.g. SetXDataLabelType()
$subtitle[] = "Format (Set{$mode}LabelType) '{$formattype}, {$formatarg}'";
}
if (empty($subtitle)) {
$title .= "\nDefaults (baseline)";
} else {
$title .= "\n" . implode(", ", $subtitle);
}
$plot = new PHPlot(800, 600);
$plot->SetDefaultTTFont($phplot_test_ttfdir . $phplot_test_ttfonts['sans']);
$plot->SetPlotType('stackedbars');
$plot->SetDataType($horiz ? 'text-data-yx' : 'text-data');
$plot->SetDataValues($data);
$plot->SetTitle($title);
if (isset($textheight)) {
$plot->SetFont($horiz ? 'x_label' : 'y_label', NULL, $textheight);
}
if (isset($textangle)) {
call_user_func(array($plot, "Set{$dep_var}DataLabelAngle"), $textangle);
}
if (isset($shading)) {
$plot->SetShading($shading);
}
call_user_func(array($plot, "Set{$ind_var}TickPos"), 'none');
call_user_func(array($plot, "Set{$dep_var}DataLabelPos"), 'plotstack');
if (isset($format)) {
call_user_func(array($plot, "Set{$dep_var}{$mode}LabelType"), $formattype, $formatarg);
}
$plot->DrawGraph();
示例15: debug_text
# Debug callback for text drawing:
function debug_text($img, $unused, $px, $py, $bbwidth, $bbheight)
{
fwrite(STDERR, "text: ({$px}, {$py}) @ ({$bbwidth}, {$bbheight})\n");
}
# The bug was originally seen with a plot using month names (Jan, Feb, ...)
# but this varies it a bit to exagerate the problem: a line with all small
# letters and no descenders, and a two-line label. Also made up "Juy" which
# has J which goes left/down from basepoint, and y which goes below.
$data = array(array('Jan', 1, 1), array('Feb', 2, 2), array('Mar', 3, 3), array('Apr', 4, 4), array('May', 5, 5), array('Juy', 6, 6), array('Jul', 7, 7), array("Aug\nSummer!", 8, 8), array('Sep', 9, 9), array("ocr", 10, 10), array('Nov', 11, 11), array('Dec', 12, 12));
$p = new PHPlot(800, 600);
$p->SetDataType('data-data');
$p->SetDataValues($data);
$p->SetPlotType('lines');
if (isset($tp['lspace'])) {
$p->SetLineSpacing($tp['lspace']);
}
#$p->SetCallback('debug_textbox', 'debug_text');
$p->SetTitle($tp['title'] . " (spacing={$tp['lspace']})" . $tp['suffix']);
$p->SetXTitle('X Axis Title');
$p->SetYTitle('Y Axis Title');
$p->SetDefaultTTFont($phplot_test_ttfdir . $phplot_test_ttfonts['sans']);
$p->SetFont('x_label', '', $tp['xlfs']);
$p->SetFont('title', '', 24);
$p->SetXDataLabelPos('plotdown');
$p->SetXTickLabelPos('none');
$p->SetXTickPos('plotdown');
$p->SetXTickIncrement(1);
$p->SetYTickIncrement(2);
$p->SetPlotAreaWorld(0, 0, 12, 12);
$p->DrawGraph();