本文整理汇总了PHP中CanvasGraph::AddText方法的典型用法代码示例。如果您正苦于以下问题:PHP CanvasGraph::AddText方法的具体用法?PHP CanvasGraph::AddText怎么用?PHP CanvasGraph::AddText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CanvasGraph
的用法示例。
在下文中一共展示了CanvasGraph::AddText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error_text
function error_text($title, $text)
{
if (OFF == plugin_config_get('eczlibrary')) {
$graph = new CanvasGraph(300, 380);
$txt = new Text($text, 150, 100);
$txt->Align("center", "center", "center");
$txt->SetFont($t_graph_font, FS_BOLD);
$graph->title->Set($title);
$graph->title->SetFont($t_graph_font, FS_BOLD);
$graph->AddText($txt);
$graph->Stroke();
} else {
$im = imagecreate(300, 300);
/* @todo check: error graphs dont support utf8 */
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 5, 0, 0, $text, $textcolor);
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
}
die;
}
示例2: showError
function showError($msj, $G_SIZE = array(400, 300), $G_TITLE = "")
{
$graph = new CanvasGraph($G_SIZE[0], $G_SIZE[1], "auto");
if ($msj == 'nothing') {
global $_MSJ_NOTHING;
$titulo = utf8_decode($_MSJ_NOTHING);
$title = new Text($G_TITLE);
$title->ParagraphAlign('center');
$title->SetFont(FF_FONT2, FS_BOLD);
$title->SetMargin(3);
$title->SetAlign('center');
$title->Center(0, $G_SIZE[0], $G_SIZE[1] / 2);
$graph->AddText($title);
} else {
$titulo = utf8_decode($msj);
}
$t1 = new Text($titulo);
$t1->SetBox("white", "black", true);
$t1->ParagraphAlign("center");
$t1->SetColor("black");
$graph->AddText($t1);
$graph->img->SetColor('navy');
$graph->img->SetTextAlign('center', 'bottom');
$graph->img->Rectangle(0, 0, $G_SIZE[0] - 1, $G_SIZE[1] - 1);
$graph->Stroke();
}
示例3: error_check
function error_check($bug_count, $title)
{
if (0 == $bug_count) {
$t_graph_font = graph_get_font();
$graph = new CanvasGraph(300, 380);
$txt = new Text(lang_get('not_enough_data'), 150, 100);
$txt->Align("center", "center", "center");
$txt->SetFont($t_graph_font, FS_BOLD);
$graph->title->Set($title);
$graph->title->SetFont($t_graph_font, FS_BOLD);
$graph->AddText($txt);
$graph->Stroke();
die;
}
}
示例4: top
function top($VAR)
{
global $smarty, $C_translate, $C_auth;
# Get the period type, default to month
if (empty($VAR['period'])) {
$p = 'm';
} else {
$p = $VAR['period'];
}
# Load the jpgraph class
include PATH_GRAPH . "jpgraph.php";
include PATH_GRAPH . "jpgraph_bar.php";
# check the validation for this function
if (!$C_auth->auth_method_by_name($this->module, 'search')) {
$error = $C_translate->translate('module_non_auth', '', '');
include PATH_GRAPH . "jpgraph_canvas.php";
$graph = new CanvasGraph(460, 55, "auto");
$t1 = new Text($error);
$t1->Pos(0.2, 0.5);
$t1->SetOrientation("h");
$t1->SetBox("white", "black", 'gray');
$t1->SetFont(FF_FONT1, FS_NORMAL);
$t1->SetColor("black");
$graph->AddText($t1);
$graph->Stroke();
exit;
}
# Get the period start & end
switch ($p) {
# By Weeks:
case 'w':
$interval = "1";
$width = ".9";
$title = 'Top Accounts for Last Last Week';
$dow = date('w');
$start_str = mktime(0, 0, 0, date('m'), date('d') - $dow, date('y'));
$end_str = mktime(23, 59, 59, date('m'), date('d'), date('y'));
break;
# By Months:
# By Months:
case 'm':
$interval = "3";
$width = ".6";
$title = 'Top Accounts for Last Last Month';
$start_str = mktime(0, 0, 0, date('m'), 1, date('y'));
$end_str = mktime(23, 59, 59, date('m'), date('d'), date('y'));
break;
# By Years:
# By Years:
case 'y':
$interval = "1";
$width = ".8";
$title = 'Top Accounts for Last Last Year';
$start_str = mktime(0, 0, 0, 1, 1, date('y'));
$end_str = mktime(23, 59, 59, date('m'), date('d'), date('y'));
break;
}
##############################@@@@@@@@
# Get accounts & sales for this period
##############################@@@@@@@@
$db =& DB();
$sql = 'SELECT account_id,total_amt FROM ' . AGILE_DB_PREFIX . 'invoice WHERE
date_orig >= ' . $db->qstr($start_str) . ' AND date_orig <= ' . $db->qstr($end_str) . ' AND
site_id = ' . $db->qstr(DEFAULT_SITE);
$result = $db->Execute($sql);
if (@$result->RecordCount() == 0) {
$file = fopen(PATH_THEMES . 'default_admin/images/invisible.gif', 'r');
fpassthru($file);
exit;
}
while (!$result->EOF) {
$amt = $result->fields['total_amt'];
$acct = $result->fields['account_id'];
if (!isset($arr[$acct])) {
$arr[$acct] = 0;
}
$arr[$acct] += $amt;
$result->MoveNext();
}
$i = 0;
while (list($key, $var) = each(@$arr)) {
# Get the user name
$sql = 'SELECT first_name,last_name FROM ' . AGILE_DB_PREFIX . 'account WHERE
id = ' . $db->qstr($key) . ' AND
site_id = ' . $db->qstr(DEFAULT_SITE);
$rs = $db->Execute($sql);
$_lbl[] = strtoupper(substr($rs->fields['first_name'], 0, 1)) . ". " . $rs->fields['last_name'];
$_datay[] = $var;
$i++;
}
### Sort the arrays
array_multisort($_datay, SORT_DESC, SORT_NUMERIC, $_lbl);
### Limit the results to 10 or less
for ($i = 0; $i < count($_lbl); $i++) {
$lbl[$i] = $_lbl[$i];
$datay[$i] = $_datay[$i];
if ($i >= 9) {
$i = count($_lbl);
}
}
//.........这里部分代码省略.........
示例5: CanvasGraph
function BAR_graph($module, $type, $start, $extra_fields)
{
global $C_translate, $C_auth;
include_once PATH_CORE . 'validate.inc.php';
$dt = new CORE_validate();
include PATH_GRAPH . "jpgraph.php";
####################################################################
### Check if 'search' is authorized for this account
####################################################################
# check the validation for this function
if ($C_auth->auth_method_by_name($module, 'search')) {
# validate this file exists, and include it.
if (file_exists(PATH_MODULES . '/' . $module . '/' . $module . '.inc.php')) {
include_once PATH_MODULES . '/' . $module . '/' . $module . '.inc.php';
} else {
### Not exist!
$error = $C_translate->translate('module_non_existant', '', '');
}
} else {
### Not auth
$error = $C_translate->translate('module_non_auth', '', '');
}
if (isset($error)) {
include PATH_GRAPH . "jpgraph_canvas.php";
// Create the graph.
$graph = new CanvasGraph(460, 55, "auto");
$t1 = new Text($error);
$t1->Pos(0.2, 0.5);
$t1->SetOrientation("h");
$t1->SetBox("white", "black", 'gray');
$t1->SetFont(FF_FONT1, FS_NORMAL);
$t1->SetColor("black");
$graph->AddText($t1);
$graph->Stroke();
exit;
}
####################################################################
### BY WEEK
####################################################################
if ($type == 'week') {
$FONT_SIZE = 7;
$AbsWidth = 12;
$interval = 4;
$type = $C_translate->translate('week', '', '');
if ($start == "" || $start <= 12) {
## Get the beginning/end of this week
$start_str = mktime(24, 0, 0, 12, 31, date("Y") - 1);
$start = date(UNIX_DATE_FORMAT, $start_str);
$end_str = mktime(24, 0, 0, 12, 30, date("Y", $start_str));
$end = date(UNIX_DATE_FORMAT, $end_str);
} else {
## Get the beginning/end of the specified week
$start_str = mktime(24, 0, 0, 12, 31, date("{$start}") - 1);
$start = date(UNIX_DATE_FORMAT, $start_str);
$end_str = mktime(24, 0, 0, 12, 30, date("Y", $start_str));
$end = date(UNIX_DATE_FORMAT, $end_str);
}
### Set the constraint array:
$curr_str = $start_str;
while ($curr_str <= $end_str) {
$new_curr_str = mktime(0, 0, 0, date("m", $curr_str), date("d", $curr_str) + 7, date("Y", $curr_str));
$constraint_array[] = array('start' => $curr_str, 'end' => $new_curr_str);
$curr_str = $new_curr_str;
$default_array[] = 0;
}
} else {
if ($type == 'month') {
$FONT_SIZE = 10;
$AbsWidth = 12;
$TickLables = $gDateLocale->GetShortMonth();
$interval = 1;
$type = $C_translate->translate('month', '', '');
if ($start == "" || $start < 12) {
## Get the beginning/end of this week
$start_str = mktime(24, 0, 0, 12, 31, date("Y") - 1);
$start = date(UNIX_DATE_FORMAT, $start_str);
$end_str = mktime(24, 0, 0, 12, 30, date("Y", $start_str));
$end = date(UNIX_DATE_FORMAT, $end_str);
} else {
## Get the beginning/end of the specified week
## Get the beginning/end of this week
$start_str = mktime(24, 0, 0, 12, 31, date("{$start}") - 1);
$start = date(UNIX_DATE_FORMAT, $start_str);
$end_str = mktime(24, 0, 0, 12, 30, date("Y", $start_str));
$end = date(UNIX_DATE_FORMAT, $end_str);
}
### Set the constraint array:
$curr_str = $start_str;
while ($curr_str <= $end_str) {
$new_curr_str = mktime(0, 0, 0, date("m", $curr_str) + 1, date("d", $curr_str), date("Y", $curr_str));
$constraint_array[] = array('start' => $curr_str, 'end' => $new_curr_str);
$curr_str = $new_curr_str;
$default_array[] = 0;
}
} else {
if ($type == 'year') {
$FONT_SIZE = 10;
$interval = 1;
$AbsWidth = 13;
$type = $C_translate->translate('year', '', '');
//.........这里部分代码省略.........
示例6: CanvasGraph
<?php
// content="text/plain; charset=utf-8"
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_canvas.php";
// Create the graph.
$graph = new CanvasGraph(350, 200);
$t1 = new Text("a good\nas you can see right now per see\nThis is a text with\nseveral lines\n");
$t1->SetPos(0.05, 100);
$t1->SetFont(FF_FONT1, FS_NORMAL);
$t1->SetBox("white", "black", true);
$t1->ParagraphAlign("right");
$t1->SetColor("black");
$graph->AddText($t1);
$graph->Stroke();
示例7: CanvasGraph
$numstick = $limit;
}
if ($limit == 0 || $limit == "") {
$graph = new CanvasGraph(660, 200, "auto");
$graph->SetMarginColor('white');
$graph->SetMargin(2, 60, 2, 25);
$graph->InitFrame();
$text = new Text(" [This chart does not have enough data]");
$text->SetPos(400, 60, 'right');
$text->SetColor("black");
$graph->AddText($text);
$graph2 = new CanvasGraph(660, 170, 'auto');
$graph2->SetMarginColor('white');
$graph2->SetMargin(2, 60, 2, 25);
$graph2->InitFrame();
$graph2->AddText($text);
if ($type == 1) {
$graph->Stroke($realpath . $prename . "1W_1.png");
$graph2->Stroke($realpath . $prename . "1W_2.png");
} elseif ($type == 2) {
//echo '111';
$graph->Stroke($realpath . $prename . "1M_1.png");
$graph2->Stroke($realpath . $prename . "1M_2.png");
} elseif ($type == 3) {
$graph->Stroke($realpath . $prename . "3M_2.png");
$graph2->Stroke($realpath . $prename . "3M_2.png");
} elseif ($type == 4) {
$graph->Stroke($realpath . $prename . "6M_2.png");
$graph2->Stroke($realpath . $prename . "6M_2.png");
} elseif ($type == 5) {
$graph->Stroke($realpath . $prename . "1Y_1.png");
示例8: ejecutarGrafico
function ejecutarGrafico($value_criteria, $date_start, $date_end)
{
global $arrLang;
$data_graph = leerDatosGrafico($value_criteria, $date_start, $date_end);
if (count($data_graph["values"]) > 0) {
// Create the Pie Graph.
$graph = new PieGraph(630, 220, "auto");
$graph->SetMarginColor('#fafafa');
$graph->SetFrame(true, '#999999');
$graph->legend->SetFillColor("#fafafa");
$graph->legend->SetColor("#444444", "#999999");
$graph->legend->SetShadow('gray@0.6', 4);
// Set A title for the plot
$graph->title->Set(utf8_decode($data_graph["title"]));
$graph->title->SetColor("#444444");
$graph->legend->Pos(0.1, 0.2);
// Create 3D pie plot
$p1 = new PiePlot3d($data_graph["values"]);
$p1->SetCenter(0.4);
$p1->SetSize(100);
// Adjust projection angle
$p1->SetAngle(60);
// Adjsut angle for first slice
$p1->SetStartAngle(45);
// Display the slice values
$p1->value->SetColor("black");
// Add colored edges to the 3D pie
// NOTE: You can't have exploded slices with edges!
$p1->SetEdge("black");
$p1->SetLegends($data_graph["legend"]);
$graph->Add($p1);
$graph->Stroke();
} else {
$graph = new CanvasGraph(630, 220, "auto");
$title = new Text(utf8_decode($data_graph["title"]));
$title->ParagraphAlign('center');
$title->SetFont(FF_FONT2, FS_BOLD);
$title->SetMargin(3);
$title->SetAlign('center');
$title->Center(0, 630, 110);
$graph->AddText($title);
$t1 = new Text(utf8_decode($arrLang["No records found"]));
$t1->SetBox("white", "black", true);
$t1->ParagraphAlign("center");
$t1->SetColor("black");
$graph->AddText($t1);
$graph->img->SetColor('navy');
$graph->img->SetTextAlign('center', 'bottom');
$graph->img->Rectangle(0, 0, 629, 219);
$graph->Stroke();
/*
//no hay datos - por ahora muestro una imagen en blanco con mensaje no records found
header('Content-type: image/png');
$titulo=utf8_decode($data_graph["title"]);
$im = imagecreate(630, 220);
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 10, 5, 5, $titulo. " - No records found", $text_color);
imagepng($im);
imagedestroy($im);*/
}
}
示例9: error_text
/**
* Display Error 'graph'
*
* @param string $p_title Error title.
* @param string $p_text Error text.
* @todo check error graphs do not support utf8
* @return void
*/
function error_text($p_title, $p_text)
{
if (OFF == plugin_config_get('eczlibrary')) {
$t_graph = new CanvasGraph(300, 380);
$t_graph_font = graph_get_font();
$t_text = new Text($p_text, 150, 100);
$t_text->Align('center', 'center', 'center');
$t_text->SetFont($t_graph_font, FS_BOLD);
$t_graph->title->Set($p_title);
$t_graph->title->SetFont($t_graph_font, FS_BOLD);
$t_graph->AddText($t_text);
$t_graph->Stroke();
} else {
$t_image = imagecreate(300, 300);
$t_text_color = imagecolorallocate($t_image, 0, 0, 0);
imagestring($t_image, 5, 0, 0, $p_text, $t_text_color);
header('Content-type: image/png');
imagepng($t_image);
imagedestroy($t_image);
}
die;
}
示例10: buildGraphicByYear
//.........这里部分代码省略.........
inicialmente ele eh inicializada com o gabarito, e serao preenchidos os valores
dos meses no laço for logo abaixo
*/
$valores = $data;
for ($k = 0; $k <= count($valores); $k++) {
if ($meses[$k]) {
$valores[$k] = $meses[$k];
}
}
if (count($valores) > 12) {
unset($valores[0]);
}
$valores = array_values($valores);
/*
aqui eu uso "Variáveis Variáveis" do PHP para poder
inserir vária linhas no gráfico
*/
$nome = "barplot" . $ano;
${$nome} = new BarPlot($valores);
$cor = $cores[$colorIndex];
${$nome}->SetFillColor($cor);
${$nome}->SetColor($cor);
/*configs para os valores do ponto*/
${$nome}->value->SetColor("darkred");
${$nome}->value->SetFont(FF_FONT1, FS_BOLD);
${$nome}->value->SetFormat("%0.1d");
// $$nome->SetWeight(20);
// Arrumando para um tamanho mais amigavel
if (count($anos) < 3) {
${$nome}->SetWidth(20);
} else {
if (count($anos) < 4) {
${$nome}->SetWidth(15);
} else {
if (count($anos) < 6) {
${$nome}->SetWidth(10);
} else {
if (count($anos) < 8) {
${$nome}->SetWidth(5);
} else {
if (count($anos) < 11) {
${$nome}->SetWidth(3);
}
}
}
}
}
${$nome}->value->Show();
${$nome}->value->iHideZero = true;
${$nome}->setLegend($ano);
/*adicionando a linha ao grafico*/
$colorIndex++;
// Somente monta o gráfico dos anos exigidos pelo usuário
for ($i = 0; $i < count($anos); $i++) {
if ($ano == $startYear + $i) {
$graficoStatus = true;
// entrou no for significa que o gráfico vai ser construido
array_push($bars, ${$nome});
}
}
}
/****************************************************************
* Se não existir dados estatísticos para o período selecionado *
* Então ele constroi uma imagem com a mensagem de que não *
* existem dados estatísticos. *
*****************************************************************/
if ($graficoStatus == false) {
$graph = new CanvasGraph(600, 30);
$t1 = new Text(GRAFIC_STATS_FALSE);
$t1->Pos(0.05, 0.5);
$t1->SetOrientation('h');
$t1->SetFont(FF_FONT1, FS_BOLD);
$t1->SetColor('black');
$graph->AddText($t1);
$graph->Stroke();
return $graficoStatus;
}
$gbplot = new GroupBarPlot($bars);
$gbplot->SetWidth(0.9);
$graph->Add($gbplot);
$graph->yaxis->scale->SetGrace(20);
$graph->img->SetMargin(40, 20, 20, 40);
$graph->title->Set(ARTICLE_ACCESS);
$graph->xaxis->title->Set(MONTHS);
$graph->yaxis->title->Set(ACCESSES);
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->SetShadow();
$graph->xaxis->SetTickLabels(explode(",", MONTH_LIST));
// Adjust the legend position
// $graph->legend->SetLayout(LEGEND_VER);
$graph->legend->Pos(0.04, 0.092, "", "center");
$graph->legend->SetLayout(LEGEND_HOR);
// Mostra o gráfico somente se, o ano que o usuario entrou existir estatisticas
if ($graficoStatus == true) {
$graph->Stroke();
}
return $graficoStatus;
}
示例11: grafic_trunk2
function grafic_trunk2(&$pDB_ast_cdr, &$pDB_ast, $module_name, $trunk, $dti, $dtf)
{
//
require_once "modules/{$module_name}/libs/paloSantoExtention.class.php";
$objPalo_AST_CDR = new paloSantoExtention($pDB_ast_cdr);
/* Si la troncal pedida es un grupo, se expande el grupo para averiguar las
troncales individuales. */
$regs = NULL;
if (preg_match('!^DAHDI/(g|r)(\\d+)$!i', $trunk, $regs)) {
$iGrupoTrunk = (int) $regs[2];
$gruposTrunk = getTrunkGroupsDAHDI();
if (is_array($gruposTrunk) && isset($gruposTrunk[$iGrupoTrunk])) {
$trunk = $gruposTrunk[$iGrupoTrunk];
}
}
//total minutos de llamadas in y out
$arrayTemp = $objPalo_AST_CDR->loadTrunks($trunk, "numcall", $dti, $dtf);
$arrResult = $arrayTemp[0];
//$arrResult[0] => "IN"
//$arrResult[1] => "OUT"
$tot = $arrResult[0] + $arrResult[1];
$usoDisco = $tot != 0 ? 100 * ($arrResult[0] / $tot) : 0;
if ($tot != 0) {
$freeDisco = 100 - $usoDisco;
// Some data
$data = array($usoDisco, $freeDisco);
// Create the Pie Graph.
$graph = new PieGraph(400, 170, "auto");
//$graph->SetShadow();
$graph->SetMarginColor('#fafafa');
$graph->SetFrame(true, '#999999');
$graph->legend->SetFillColor("#fafafa");
//$graph->legend->Pos(0.012, 0.5, "right","center");
$graph->legend->SetColor("#444444", "#999999");
$graph->legend->SetShadow('gray@0.6', 4);
//$graph->title->SetColor("#444444");
// Set A title for the plot
$graph->title->Set(utf8_decode(_tr("Number of Calls")));
//$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
$graph->title->SetColor("#444444");
$graph->legend->Pos(0.04, 0.2);
// Create 3D pie plot
$p1 = new PiePlot3d($data);
//$p1->SetTheme("water");
$p1->SetSliceColors(array("#3333cc", "#9999cc", "#CC3333", "#72394a", "#aa3424"));
$p1->SetCenter(0.3);
$p1->SetSize(80);
// Adjust projection angle
$p1->SetAngle(45);
// Adjsut angle for first slice
$p1->SetStartAngle(45);
// Display the slice values
//$p1->value->SetFont(FF_ARIAL,FS_BOLD,11);
//$p1->value->SetColor("navy");
$p1->value->SetColor("black");
// Add colored edges to the 3D pies
// NOTE: You can't have exploded slices with edges!
$p1->SetEdge("black");
$p1->SetLegends(array(utf8_decode(_tr("Incoming Calls") . ": ") . $arrResult[0], utf8_decode(_tr("Outcoming Calls") . ": ") . $arrResult[1]));
$graph->Add($p1);
$graph->Stroke();
} else {
$graph = new CanvasGraph(400, 140, "auto");
$title = new Text(utf8_decode(_tr("Number of Calls")));
$title->ParagraphAlign('center');
$title->SetFont(FF_FONT2, FS_BOLD);
$title->SetMargin(3);
$title->SetAlign('center');
$title->Center(0, 400, 70);
$graph->AddText($title);
$t1 = new Text(utf8_decode(_tr("There are no data to present")));
$t1->SetBox("white", "black", true);
$t1->ParagraphAlign("center");
$t1->SetColor("black");
$graph->AddText($t1);
$graph->img->SetColor('navy');
$graph->img->SetTextAlign('center', 'bottom');
$graph->img->Rectangle(0, 0, 399, 139);
$graph->Stroke();
}
}