• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CanvasGraph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CanvasGraph的典型用法代码示例。如果您正苦于以下问题:PHP CanvasGraph类的具体用法?PHP CanvasGraph怎么用?PHP CanvasGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CanvasGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: 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();
}
开发者ID:hardikk,项目名称:HNH,代码行数:26,代码来源:paloSantoGraphImage.lib.php


示例2: CanvasGraph

<?php

// $Id: canvas_jpgarchex.php,v 1.1.1.1 2005/11/30 23:01:53 gth2 Exp $
include "../jpgraph.php";
include "../jpgraph_canvas.php";
include "../jpgraph_canvtools.php";
// Scale we are using
$ymax = 24;
$xmax = 20;
// Setup the basic canvas
$g = new CanvasGraph(700, 650, 'auto');
$g->SetMargin(2, 3, 2, 3);
$g->SetMarginColor("teal");
$g->InitFrame();
// ... and a scale
$scale = new CanvasScale($g);
$scale->Set(0, $xmax, 0, $ymax);
// ... we need shape since we want the indented rectangle
$shape = new Shape($g, $scale);
$shape->SetColor('black');
// ... basic parameters for the overall image
$l = 2;
// Left margin
$r = 18;
// Row number to start the lowest line on
$width = 16;
// Total width
// Setup the two basic rectangle text object we  will use
$tt = new CanvasRectangleText();
$tt->SetFont(FF_ARIAL, FS_NORMAL, 14);
$tt->SetFillColor('');
开发者ID:nourchene-benslimane,项目名称:rth_backup,代码行数:31,代码来源:canvas_jpgarchex.php


示例3: 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;
}
开发者ID:kaos,项目名称:mantisbt,代码行数:23,代码来源:graph_api.php


示例4: array

<?php

require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_canvas.php';
require_once 'jpgraph/jpgraph_table.php';
$cols = 4;
$rows = 3;
$data = array(array('', 'Jan', 'Feb', 'Mar', 'Apr'), array('Min', '15.2', '12.5', '9.9', '70.0'), array('Max', '23.9', '14.2', '18.6', '71.3'));
// Setup basic graph canvas
$graph = new CanvasGraph(300, 200);
// Create a basic table
$table = new GTextTable($cols, $rows);
$table->Set($data);
$table->SetCellCSIMTarget(1, 1, 'tableex02.php', 'View details');
$table->SetRowFont(0, FF_FONT1, FS_BOLD);
$table->SetRowColor(0, 'navy');
$table->SetRowFillColor(0, 'lightgray');
$table->SetColFont(0, FF_FONT1, FS_BOLD);
$table->SetColColor(0, 'navy');
$table->SetColFillColor(0, 'lightgray');
$graph->Add($table);
$graph->StrokeCSIM();
开发者ID:hcvcastro,项目名称:pxp,代码行数:22,代码来源:tableex01_csim.php


示例5: 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);
            }
        }
//.........这里部分代码省略.........
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:101,代码来源:account_admin.inc.php


示例6: CanvasGraph

<?php

require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_canvas.php';
require_once 'jpgraph/jpgraph_table.php';
// Setup graph context
$graph = new CanvasGraph(430, 150);
// Setup the basic table
$data = array(array('', 'w631', 'w632', 'w633', 'w634', 'w635', 'w636'), array('Critical (sum)', 13, 17, 15, 8, 3, 9), array('High (sum)', 34, 35, 26, 20, 22, 16), array('Low (sum)', 41, 43, 49, 45, 51, 47), array('Sum:', 88, 95, 90, 73, 76, 72));
// Setup a basic table
$table = new GTextTable();
$table->Set($data);
// Setup fonts
$table->SetFont(FF_TIMES, FS_NORMAL, 11);
$table->SetColFont(0, FF_ARIAL, FS_NORMAL, 11);
$table->SetRowFont(0, FF_ARIAL, FS_NORMAL, 11);
$table->SetRowFont(4, FF_TIMES, FS_BOLD, 14);
// Turn off the grid
$table->SetGrid(0);
// Setup color
$table->SetRowFillColor(0, '[email protected]');
$table->SetRowFillColor(4, '[email protected]');
$table->SetColFillColor(0, '[email protected]');
$table->SetFillColor(0, 0, 4, 0, '[email protected]');
// Set default minimum column width
$table->SetMinColWidth(45);
// Set default table alignment
$table->SetAlign('right');
// Add table to the graph
$graph->Add($table);
// and send it back to the client
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:31,代码来源:table_mex0.php


示例7: 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;
 }
开发者ID:robertatakenaka,项目名称:Proceedings,代码行数:101,代码来源:AccessServiceBar.php


示例8: CanvasGraph

<?php

// $Id: listfontsex1.php,v 1.3 2002/10/25 22:44:15 aditus Exp $
include "../jpgraph.php";
include "../jpgraph_canvas.php";
include "../jpgraph_canvtools.php";
$g = new CanvasGraph(550, 450, 'auto');
$scale = new CanvasScale($g);
$scale->Set(0, 27, 0, 53);
$g->SetMargin(5, 6, 5, 6);
$g->SetColor('white');
$g->SetMarginColor("teal");
$g->InitFrame();
$t = new CanvasRectangleText();
$t->SetFillColor('lightgreen');
$t->SetFontColor('navy');
$t->SetFont(FF_ARIAL, FS_NORMAL, 16);
$t->Set("\n\n\n\n\n\n\n\n\n\n\nTTF Fonts", 0.5, 19, 26, 32);
$t->Stroke($g->img, $scale);
$t = new CanvasRectangleText();
$t->SetFillColor('');
$t->SetFontColor('black');
$t->SetColor('');
$t->SetShadow('');
$t->SetFont(FF_ARIAL, FS_BOLD, 18);
$t->Set('Family', 1, 1, 8);
$t->Stroke($g->img, $scale);
$t->Set('Italic style', 9, 1, 8);
$t->Stroke($g->img, $scale);
$t->Set('Bold style', 17.5, 1, 8);
$t->Stroke($g->img, $scale);
开发者ID:tavo1981,项目名称:phpbar,代码行数:31,代码来源:listfontsex1.php


示例9: 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();
开发者ID:hcvcastro,项目名称:pxp,代码行数:15,代码来源:text-example2.php


示例10: CanvasGraph

 //end switch
 $result = $db->sql_query($sql);
 $limit = $db->sql_numrows($result);
 if ($limit < $numstick) {
     $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) {
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:31,代码来源:chart_market_hcm.php


示例11: BAR_graph

 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', '', '');
//.........这里部分代码省略.........
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:101,代码来源:graph.inc.php


示例12: Draw

 public function Draw($aTitle, $aStart, $aEnd, $n = 64, $aReverse = false, $addColorNames = false)
 {
     // Setup to draw colormap with names platoe colors
     $lmarg = ColorMapDriver::LMARG;
     // left margin
     $rmarg = ColorMapDriver::RMARG;
     // right margin
     $width = ColorMapDriver::WIDTH;
     // Overall image width
     // Module height
     $mh = ColorMapDriver::MODHEIGHT;
     // Step between each map
     $ymarg = $mh + ColorMapDriver::MAPMARG;
     if ($addColorNames) {
         $ymarg += 50;
     }
     // Start position
     $xs = $lmarg;
     $ys = ColorMapDriver::YSTART;
     // Setup a basic canvas graph
     $height = ($aEnd - $aStart + 1) * $ymarg + 50;
     $graph = new CanvasGraph($width, $height);
     $graph->img->SetColor('darkgray');
     $graph->img->Rectangle(0, 0, $width - 1, $height - 1);
     $t = new Text($aTitle, $width / 2, 5);
     $t->SetAlign('center', 'top');
     $t->SetFont(FF_ARIAL, FS_BOLD, 14);
     $t->Stroke($graph->img);
     // Instantiate a colormap
     $cm = new ColorMap();
     $cm->InitRGB($graph->img->rgb);
     for ($mapidx = $aStart; $mapidx <= $aEnd; ++$mapidx, $ys += $ymarg) {
         $cm->SetMap($mapidx, $aReverse);
         $n = $cm->SetNumColors($n);
         list($mapidx, $maparray) = $cm->GetCurrMap();
         $ncols = count($maparray);
         $colbuckets = $cm->GetBuckets();
         // The module width will depend on the actual number of colors
         $mw = round(($width - $lmarg - $rmarg) / $n);
         // Draw color map title (name)
         $t->Set('Basic colors: ' . $ncols . ',   Total colors: ' . $n);
         $t->SetAlign('center', 'bottom');
         $t->SetAngle(0);
         $t->SetFont(FF_TIMES, FS_NORMAL, 14);
         $t->Stroke($graph->img, $width / 2, $ys - 3);
         // Add the name/number of the map to the left
         $t->SetAlign('right', 'center');
         $t->Set('Map: ' . $mapidx);
         $t->SetFont(FF_ARIAL, FS_NORMAL, 14);
         $t->Stroke($graph->img, $xs - 20, round($ys + $mh / 2));
         // Setup text properties for the color names
         if ($addColorNames) {
             $t->SetAngle(30);
             $t->SetFont(FF_ARIAL, FS_NORMAL, 12);
             $t->SetAlign('right', 'top');
         }
         // Loop through all colors in the map
         $x = $xs;
         $y = $ys;
         $k = 0;
         for ($i = 0; $i < $n; ++$i) {
             $graph->img->SetColor($colbuckets[$i]);
             $graph->img->FilledRectangle($x, $y, $x + $mw, $y + $mh);
             // Mark all basic colors in the map with a bar and name
             if ($i % (($n - $ncols) / ($ncols - 1) + 1) == 0) {
                 $graph->img->SetColor('black');
                 $graph->img->FilledRectangle($x, $y + $mh + 4, $x + $mw - 1, $y + $mh + 6);
                 if ($addColorNames) {
                     $t->Set($maparray[$k++]);
                     $t->Stroke($graph->img, $x + $mw / 2, $y + $mh + 10);
                 }
             }
             $x += $mw;
         }
         // Draw a border around the map
         $graph->img->SetColor('black');
         $graph->img->Rectangle($xs, $ys, $xs + $mw * $n, $ys + $mh);
     }
     // Send back to client
     $graph->Stroke();
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:81,代码来源:colormaps.php


示例13: 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('[email protected]', 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);*/
    }
}
开发者ID:hardikk,项目名称:HNH,代码行数:62,代码来源:index.php


示例14: 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;
}
开发者ID:gtn,项目名称:mantisbt,代码行数:30,代码来源:graph_api.php


示例15: Stroke

 function Stroke($aData, $aFile = '', $aShowDetails = false, $aShowEncodingDetails = false)
 {
     $textmargin = 5;
     $this->iEncoder->AddChecksum($this->iUseChecksum);
     $spec = $this->iEncoder->Enc($aData);
     $this->AdjustSpec($spec);
     if ($this->iFontFam == -1) {
         if ($this->iModuleWidth > 1) {
             $this->iFontFam = FF_FONT2;
             $this->iFontStyle = FS_BOLD;
         } else {
             $this->iFontFam = FF_FONT1;
             $this->iFontStyle = FS_BOLD;
         }
     }
     $s = '';
     $n = count($spec->iBar);
     $g = new CanvasGraph(0, 0);
     $g->img->SetImgFormat($this->iImgFormat);
     if ($aShowDetails) {
         $s = $spec->iEncoding . "\n";
         $s .= 'Data: ' . $spec->iData . "\n";
         if ($spec->iInfo != '') {
             $s .= 'Info: ' . $spec->iInfo . "\n";
         }
     }
     $w = round($spec->iModuleWidth);
     $totwidth = $spec->iLeftMargin * $w;
     $n = count($spec->iBar);
     for ($i = 0; $i < $n; ++$i) {
         $b = $spec->iBar[$i];
         $bn = strlen($b[3]);
         for ($j = 0; $j < $bn; ++$j) {
             $wb = substr($b[3], $j, 1) * $w;
             $totwidth += $wb;
         }
     }
     if ($spec->iInterCharModuleSpace) {
         $totwidth += ($n - 2) * $w;
     }
     $totwidth += $spec->iRightMargin * $w + 1;
     $height = $this->iHeight;
     if ($aShowDetails) {
         $g->img->SetFont(FF_FONT2);
         $height += $g->img->GetTextHeight($s);
     }
     $g->img->SetFont($this->iFontFam, $this->iFontStyle, $this->iFontSize);
     $th = $g->img->GetTextHeight($spec->iData);
     if ($spec->iStrokeDataBelow) {
         $height += $th + $this->iDataBelowMargin;
     }
     if ($height < round(0.15 * ($totwidth - $spec->iRightMargin * $w - $spec->iLeftMargin * $w))) {
         $height = round(0.15 * $totwidth);
     }
     $g->img->SetFont(FF_FONT2);
     $tw = 2 * $textmargin + $g->img->GetTextWidth($s);
     $width = $totwidth;
     if ($width < $tw) {
         $width = $tw;
     }
     if ($aShowEncodingDetails) {
         $g->img->SetFont(FF_FONT2);
         $height += $n * $g->img->GetTextHeight('0');
         $width = max(300, $totwidth);
     }
     $g = new CanvasGraph($width, $height);
     $g->img->SetImgFormat($this->iImgFormat);
     $g->SetMarginColor('white');
     if ($this->iShowFrame) {
         $g->frame_color = $this->iFrameColor;
         $g->InitFrame();
     }
     $g->img->SetColor('black');
     $x = $w * $spec->iLeftMargin;
     $ystart = $this->iTopMargin;
     $yend = $height - $this->iBottomMargin - 1;
     if ($aShowDetails) {
         $ystart += $g->img->GetTextHeight($s);
     }
     if ($aShowEncodingDetails) {
         $g->img->SetFont(FF_FONT2);
         $ystart += $n * $g->img->GetTextHeight('0');
     }
     if ($spec->iStrokeDataBelow) {
         $yend -= $th + $this->iDataBelowMargin;
     }
     $inunder = false;
     $under_s = '';
     $under_x = 0;
     for ($i = 0; $i < $n; ++$i) {
         $b = $spec->iBar[$i];
         if ($aShowEncodingDetails) {
             $s .= sprintf("%02d", $i) . " : {$b['0']}, {$b['1']}, {$b['2']}, {$b['3']}\n";
         }
         $bn = strlen($b[3]);
         if ($b[2] == 0 && !$this->iNoHumanText) {
             if (!$inunder) {
                 $inunder = true;
                 $under_x = $x;
                 $under_s = $b[0];
//.........这里部分代码省略.........
开发者ID:halimc17,项目名称:magsys,代码行数:101,代码来源:jpgraph_barcode.php


示例16: Stroke

 function Stroke($aData, $aFile = '', $aOnlyDebug = false)
 {
     $topmargin = 10;
     $bottommargin = 10;
     $textmargin = 5;
     $txtmargin = 4;
     $this->iHeight *= $this->iModuleWidth;
     $spec = $this->iEncoder->Enc($aData);
     if ($aOnlyDebug) {
         return $spec->toString();
     }
     $this->AdjustSpec($spec);
     $data = '';
     if (is_array($aData)) {
         $n = count($aData);
         for ($i = 0; $i < $n; ++$i) {
             $data .= $aData[$i][1];
         }
     } elseif (is_string($aData)) {
         $data = $aData;
     }
     if (!$this->iFontSpecified) {
         if ($this->iModuleWidth > 1) {
             $this->iFontFam = FF_ARIAL;
             $this->iFontStyle = FS_BOLD;
             $this->iFontSize = 10;
         } else {
             $this->iFontFam = FF_ARIAL;
             $this->iFontStyle = FS_NORMAL;
             $this->iFontSize = 7;
         }
     }
     $s = '';
     $g = new CanvasGraph(0, 0);
     // Dummy graph context
     $g->img->SetImgFormat($this->iImgFormat);
     $w = round($spec->iModuleWidth);
     // Calculate total width
     $totwidth = $spec->iLeftMargin * $w;
     $n = count($spec->iBar[0]);
     for ($i = 0; $i < $n; ++$i) {
         $b = $spec->iBar[0][$i];
         $bn = strlen($b[3]);
         for ($j = 0; $j < $bn; ++$j) {
             $wb = substr($b[3], $j, 1) * $w;
             $totwidth += $wb;
         }
     }
     $totwidth += $spec->iRightMargin * $w;
     // Calculate total height
     $height = $this->iHeight * count($spec->iBar) + $topmargin + $bottommargin;
     $g->img->SetFont($this->iFontFam, $this->iFontStyle, $this->iFontSize);
     $th = $g->img->GetTextHeight($data) + $txtmargin;
     if ($spec->iStrokeDataBelow) {
         $height += $th;
     }
     $width = $totwidth;
     $g->img->SetFont(FF_FONT2);
     $tw = 2 * $textmargin + $g->img->GetTextWidth($s);
     if ($width < $tw) {
         $width = $tw;
     }
     $g = new CanvasGraph($width, $height);
     $g->img->SetImgFormat($this->iImgFormat);
     $g->SetMarginColor($this->iBkgColor);
     $g->SetColor($this->iBkgColor);
     if ($this->iShowFrame) {
         $g->InitFrame();
     } else {
         $g->frame_weight = 0;
         $g->InitFrame();
     }
     $g->img->SetLineWeight(1);
     $g->img->SetColor('black');
     $x = $w * $spec->iLeftMargin;
     $ystart = $topmargin;
     $inunder = false;
     $under_s = '';
     $startx = $x;
     for ($r = 0; $r < count($spec->iBar); ++$r) {
         $yend = $ystart + $this->iHeight - 1;
         $x = $startx;
         for ($i = 0; $i < $n; ++$i) {
             $b = $spec->iBar[$r][$i];
             $bn = strlen($b[3]);
             for ($j = 0; $j < $bn; ++$j) {
                 $wb = substr($b[3], $j, 1) * $w;
                 if (!($j % 2)) {
                     $g->img->SetColor($this->iColor);
                     $g->img->FilledRectangle($x, $ystart, $x + $wb - 1, $yend);
                 }
                 $x += $wb;
             }
         }
         $ystart += $this->iHeight;
     }
     // row
     $g->img->SetColor($this->iColor);
     if ($spec->iStrokeDataBelow) {
         // Center data underneath
//.........这里部分代码省略.........
开发者ID:rebuy-de,项目名称:jpgraph,代码行数:101,代码来源:pdf417_backends.inc.php


示例17: CanvasGraph

<?php

// content="text/plain; charset=utf-8"
// $Id: canvasex03.php,v 1.1 2002/08/27 20:08:57 aditus Exp $
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_canvas.php';
require_once 'jpgraph/jpgraph_canvtools.php';
// Define work space
$xmax = 20;
$ymax = 20;
// Setup a basic canvas we can work
$g = new CanvasGraph(400, 200, 'auto');
$g->SetMargin(5, 11, 6, 11);
$g->SetShadow();
$g->SetMarginColor("teal");
// We need to stroke the plotarea and margin before we add the
// text since we otherwise would overwrite the text.
$g->InitFrame();
// Create a new scale
$scale = new CanvasScale($g);
$scale->Set(0, $xmax, 0, $ymax);
// The shape class is wrapper around the Imgae class which translates
// the coordinates for us
$shape = new Shape($g, $scale);
$shape->SetColor('black');
// Add a black line
$shape->SetColor('black');
$shape->Line(0, 0, 20, 20);
// .. and a circle (x,y,diameter)
$shape->Circle(5, 14, 2);
// .. and a filled circle (x,y,diameter)
开发者ID:hcvcastro,项目名称:pxp,代码行数:31,代码来源:canvasex03.php


示例18: 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;
    }
}
开发者ID:jin255ff,项目名称:company_website,代码行数:15,代码来源:graph_api.php


示例19: CanvasGraph

            $img->Line($x, $y, $x + $s1 * $w, $y);
        } else {
            $x = $x + $s2 * $w * $r;
            $w = (1 - $r) * $w;
            $h = $h / (1 - $r) * $r;
            $s2 *= -1;
            $img->SetColor($color1);
            $img->Line($x, $y, $x, $y - $s2 * $h);
        }
        $img->SetColor($color2);
        $img->FilledRectangle($x - 1, $y - 1, $x + 1, $y + 1);
        $img->Arc($x, $y, 2 * $w + 1, 2 * $h + 1, $sa, $ea);
        $img->Arc($x, $y, 2 * $w, 2 * $h, $sa, $ea);
        $img->Arc($x, $y, 2 * $w - 1, 2 * $h - 1, $sa, $ea);
        $img->Line($x_old, $y_old, $x, $y);
        $x_old = $x;
        $y_old = $y;
    }
}
$g = new CanvasGraph($w, $h);
//$gr = 1.61803398874989484820;
$p = SeaShell($g->img, 0, 20, $w - 1, $h - 21, $r, 19);
$g->img->SetColor('black');
$g->img->Rectangle(0, 20, $w - 1, $h - 1);
$g->img->SetFont(FF_FONT2, FS_BOLD);
$g->img->SetTextAlign('center', 'top');
$g->img->StrokeText($w / 2, 0, "Canvas Spiral");
$g->Stroke();
?>

开发者ID:bailey-ann,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Checker类代码示例发布时间:2022-05-23
下一篇:
PHP CakeText类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap