当前位置: 首页>>代码示例>>PHP>>正文


PHP Graph::Set90AndMargin方法代码示例

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


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

示例1: ShowHBar

/**
 * Show Horizontal Bar graph
 */
function ShowHBar(&$legend, &$value)
{
    $height = 50 + count($value) * 18;
    $width = 500;
    // Set the basic parameters of the graph
    $graph = new Graph($width, $height, 'auto');
    $graph->SetScale("textlin");
    $top = 30;
    $bottom = 20;
    $left = 100;
    $right = 50;
    $graph->Set90AndMargin($left, $right, $top, $bottom);
    $graph->xaxis->SetTickLabels($legend);
    $graph->SetFrame(false);
    // Label align for X-axis
    $graph->xaxis->SetLabelAlign('right', 'center', 'right');
    // Label align for Y-axis
    $graph->yaxis->SetLabelAlign('center', 'bottom');
    // Create a bar pot
    $bplot = new BarPlot($value);
    $bplot->SetFillColor("orange");
    $bplot->SetWidth(0.5);
    // We want to display the value of each bar at the top
    $graph->yaxis->scale->SetGrace(10);
    $graph->yaxis->SetLabelAlign('center', 'bottom');
    $graph->yaxis->SetLabelFormat('%d');
    $bplot->value->Show();
    $bplot->value->SetFormat('%.d votes');
    // Setup color for gradient fill style
    $bplot->SetFillGradient("navy", "lightsteelblue", GRAD_MIDVER);
    $graph->Add($bplot);
    $graph->Stroke();
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:36,代码来源:graphs.php

示例2: makeGraph

function makeGraph($x_data, $y_data, $num_results, $title = "Statistics", $graph_type = "bar", $graph_scale = "textint")
{
    // default graph info
    $width = 600;
    $height = 500;
    $top = 60;
    $bottom = 30;
    $left = 80;
    $right = 30;
    if ($graph_type != 'csv' && $num_results == 0) {
        header('Content-type: image/png');
        readfile($GLOBALS['BASE_DIR'] . '/images/no-calls.png');
        exit;
    }
    // Set the basic parameters of the graph
    switch ($graph_type) {
        case "line":
            //do line graph here
            break;
            // not really a graph, returns comma seperated values
        // not really a graph, returns comma seperated values
        case "csv":
            header("content-type: text/csv");
            header('Content-Disposition: attachment; filename="statistics.csv"');
            $columns = implode(',', $x_data);
            $rows = implode(',', $y_data);
            echo $columns . "\n" . $rows;
            break;
        case "bar":
        default:
            // bar is default
            $graph = new Graph($width, 90 + 10 * $num_results, 'auto');
            $graph->SetScale($graph_scale);
            // Nice shadow
            $graph->SetShadow();
            $graph->Set90AndMargin($left, $right, $top, $bottom);
            // Setup labels
            $graph->xaxis->SetTickLabels($x_data);
            // Label align for X-axis
            $graph->xaxis->SetLabelAlign('right', 'center', 'right');
            // Label align for Y-axis
            $graph->yaxis->SetLabelAlign('center', 'bottom');
            // Create a bar pot
            $bplot = new BarPlot($y_data);
            $bplot->SetFillColor("#708090");
            $bplot->SetWidth(0.5);
            $bplot->SetYMin(0);
            //$bplot->SetYMin(1990);
            $graph->title->Set($title);
            $graph->Add($bplot);
            $graph->Stroke();
    }
}
开发者ID:AholibamaSI,项目名称:plymouth-webapp,代码行数:53,代码来源:statistics_image.php

示例3: executeBarGraph

 public function executeBarGraph()
 {
     //Set the response header to a image JPEG datastream
     $this->getResponse()->setContent('image/jpeg');
     // Change this defines to where Your fonts are stored
     DEFINE("TTF_DIR", "/usr/share/fonts/truetype/freefont/");
     // Change this define to a font file that You know that You have
     DEFINE("TTF_SANS", "FreeSans.ttf");
     $util = new util();
     $dataDVDrip = $util->getTotalFormat('DVDrip', 'movies');
     $dataHDrip = $util->getTotalFormat('HDrip', 'movies');
     $data720p = $util->getTotalFormat('720p', 'movies');
     $data1080p = $util->getTotalFormat('1080p', 'movies');
     $datay = array($dataDVDrip, $dataHDrip, $data720p, $data1080p);
     $graph = new Graph(199, 145);
     $graph->SetScale('textlin');
     $graph->SetColor('black');
     $graph->SetMarginColor('#393939');
     $graph->SetFrame(true, '#393939');
     $top = 25;
     $bottom = 20;
     $left = 50;
     $right = 20;
     $graph->Set90AndMargin($left, $right, $top, $bottom);
     // Setup labels
     $lbl = array("DVDrip", "HDrip", "720p", "1080p");
     $graph->xaxis->SetTickLabels($lbl);
     $graph->xaxis->SetColor('white');
     $graph->xaxis->SetLabelAlign('right', 'center', 'right');
     $graph->yaxis->SetLabelAlign('center', 'bottom');
     $graph->yaxis->SetColor('white');
     // Create a bar pot
     $bplot = new BarPlot($datay);
     $bplot->SetWidth(0.5);
     $bplot->SetFillGradient(array(250, 2, 2), array(109, 2, 2), GRAD_VERT);
     $graph->Add($bplot);
     $graph->Stroke();
     return sfView::NONE;
 }
开发者ID:nass600,项目名称:homeCENTER,代码行数:39,代码来源:actions.class.php

示例4: array

// creamos dos grupos y añadimos sus valores
$data = array();
foreach ($var as $value) {
    $data['title'][] = $value['var1'];
    $data['value'][] = $value['var2'];
}
//
require_once 'ossim_conf.inc';
$conf = $GLOBALS["CONF"];
$jpgraph = $conf->get_conf("jpgraph_path");
require_once "{$jpgraph}/jpgraph.php";
require_once "{$jpgraph}/jpgraph_bar.php";
// Setup the graph.
$graph = new Graph(600, 250, "auto");
$graph->SetScale("textlin");
$graph->Set90AndMargin(270, 10, 20, 0);
$graph->SetMarginColor("#fafafa");
$graph->xaxis->SetTickLabels($data['title']);
$graph->SetColor("#fafafa");
$graph->SetFrame(true, '#fafafa', 0);
// Create the bar plots
$b1plot = new BarPlot($data['value']);
// color@transparencia
$b1plot->SetFillColor(array(COLOR1 . "@0.5", COLOR2 . "@0.5", COLOR3 . "@0.5", COLOR4 . "@0.5", COLOR5 . "@0.5", COLOR6 . "@0.5", COLOR7 . "@0.5", COLOR8 . "@0.5", COLOR9 . "@0.5", COLOR10 . "@0.5", COLOR11 . "@0.5", COLOR12 . "@0.5"));
//
$b1plot->SetShadow(array(COLOR1 . "@0.7", COLOR2 . "@0.7", COLOR3 . "@0.7", COLOR4 . "@0.7", COLOR5 . "@0.7", COLOR6 . "@0.7", COLOR7 . "@0.7", COLOR8 . "@0.7", COLOR9 . "@0.7", COLOR10 . "@0.7", COLOR11 . "@0.7", COLOR12 . "@0.7"), 5, 5);
$b1plot->SetColor(array(COLOR1 . "@1", COLOR2 . "@1", COLOR3 . "@1", COLOR4 . "@1", COLOR5 . "@1", COLOR6 . "@1", COLOR7 . "@1", COLOR8 . "@1", COLOR9 . "@1", COLOR10 . "@1", COLOR11 . "@1", COLOR12 . "@1"));
//
$graph->Add($b1plot);
// Finally send the graph to the browser
$graph->Stroke();
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:ISO27001Bar2.php

示例5: SQLTool

}
$sqltool = new SQLTool();
$res = $sqltool->dbQuery("select depart_name,depart_id,(select count(req_num) from t_req,t_user where t_req.req_author=t_user.user_name and t_user.depart_id=t_depart.depart_id {$sql}) num from t_depart order by num desc");
for ($i = 0; $i < count($res); $i++) {
    $datay[$i] = $res[$i][2];
    $datax[$i] = $res[$i][0];
}
// Size of graph
$width = 870;
$height = count($res) * 40 + 20;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale('textlin');
$graph->setcolor('white');
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(100, 20, 30, 10);
// Setup title
$graph->title->Set($title);
$graph->title->SetFont(FF_SIMSUN, FS_BOLD, 12);
// Setup X-axis
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetFont(FF_SIMSUN, FS_NORMAL, 10);
// Some extra margin looks nicer
$graph->xaxis->SetLabelMargin(10);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('right', 'center');
// Add some grace to y-axis so the bars doesn't go
// all the way to the end of the plot area
$graph->yaxis->scale->SetGrace(10);
// We don't want to display Y-axis
$graph->yaxis->Hide();
开发者ID:huzhiming12,项目名称:itil,代码行数:31,代码来源:bar_depart_req.php

示例6: array

<?php

// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_bar.php';
$datay = array(17, 22, 33, 48, 24, 20);
// Create the graph. These two calls are always required
$graph = new Graph(220, 300, 'auto');
$graph->SetScale("textlin");
$theme_class = new UniversalTheme();
$graph->SetTheme($theme_class);
$graph->Set90AndMargin(50, 40, 40, 40);
$graph->img->SetAngle(90);
// set major and minor tick positions manually
$graph->SetBox(false);
//$graph->ygrid->SetColor('gray');
$graph->ygrid->Show(false);
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('A', 'B', 'C', 'D', 'E', 'F'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false, false);
// For background to be gradient, setfill is needed first.
$graph->SetBackgroundGradient('#00CED1', '#FFFFFF', GRAD_HOR, BGRAD_PLOT);
// Create the bar plots
$b1plot = new BarPlot($datay);
// ...and add it to the graPH
$graph->Add($b1plot);
$b1plot->SetWeight(0);
$b1plot->SetFillGradient("#808000", "#90EE90", GRAD_HOR);
$b1plot->SetWidth(17);
// Display the graph
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:31,代码来源:new_bar4.php

示例7: GerarGraficoBarraHorizontal

 function GerarGraficoBarraHorizontal()
 {
     require_once "../biblioteca/jpgraph/jpgraph.php";
     require_once "../biblioteca/jpgraph/jpgraph_bar.php";
     $graph = new Graph($this->largura, $this->altura, "png");
     $graph->SetScale("textlin");
     $graph->Set90AndMargin(600, 40, 40, 40);
     $graph->xaxis->SetPos('min');
     $graph->SetShadow($this->cor_sombra);
     $graph->title->Set($this->titulo);
     $graph->subtitle->Set($this->subtitulo);
     $graph->xaxis->SetTickLabels($this->dados_eixoX);
     $graph->xaxis->SetLabelMargin(15);
     $graph->xaxis->SetLabelAlign('right', 'center');
     $graph->xaxis->SetLabelFormat($this->label_formato);
     $graph->yaxis->SetPos('max');
     $graph->yaxis->SetLabelAlign('center', 'top');
     $graph->yaxis->SetLabelSide(SIDE_RIGHT);
     $graph->yaxis->SetTickSide(SIDE_LEFT);
     $graph->yaxis->SetTitleSide(SIDE_RIGHT);
     $graph->yaxis->SetTitleMargin(50);
     $graph->yaxis->SetTitle("");
     $graph->yaxis->title->Align('left');
     $graph->yaxis->title->SetAngle(0);
     $bplot = new BarPlot($this->dados_eixoY);
     $bplot->SetFillColor($this->cor_barra);
     $bplot->SetShadow($this->cor_sombra);
     $bplot->value->Show();
     $bplot->value->SetAlign('left', 'center');
     $bplot->value->SetColor("black", "darkred");
     $bplot->value->SetFormat($this->formato);
     // Add the bar to the graph
     $graph->Add($bplot);
     $graph->Stroke("imagens/graficos/" . $this->nome);
 }
开发者ID:silloty,项目名称:vox,代码行数:35,代码来源:grafico.gti.php

示例8: array

// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_bar.php';
$datay = array(2, 3, 5, 8, 12, 6, 3);
$datax = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul");
$width = 400;
$height = 500;
// Set the basic parameters of the graph
$graph = new Graph($width, $height, 'auto');
$graph->SetScale("textlin");
$top = 80;
$bottom = 30;
$left = 50;
$right = 30;
$graph->Set90AndMargin($left, $right, $top, $bottom);
// Nice shadow
$graph->SetShadow();
// Setup title
$graph->title->Set("Horizontal bar graph ex 2");
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 14);
$graph->subtitle->Set("(Axis at top)");
// Setup X-axis
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetFont(FF_VERDANA, FS_NORMAL, 12);
// Some extra margin looks nicer
$graph->xaxis->SetLabelMargin(5);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('right', 'center');
// Add some grace to y-axis so the bars doesn't go
// all the way to the end of the plot area
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:30,代码来源:horizbarex2.php

示例9: top


//.........这里部分代码省略.........
                $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);
            }
        }
        $i = count($lbl);
        # Get the Currency
        $sql = 'SELECT symbol FROM ' . AGILE_DB_PREFIX . 'currency WHERE
					id           =  ' . $db->qstr(DEFAULT_CURRENCY) . ' AND
					site_id      =  ' . $db->qstr(DEFAULT_SITE);
        $rs = $db->Execute($sql);
        $currency_iso = $rs->fields['symbol'];
        // Size of graph
        $width = 265;
        $height = 75 + $i * 15;
        // Set the basic parameters of the graph
        $graph = new Graph($width, $height, 'auto');
        $graph->SetScale("textlin");
        $graph->yaxis->scale->SetGrace(50);
        $graph->SetMarginColor('#F9F9F9');
        $graph->SetFrame(true, '#CCCCCC', 1);
        $graph->SetColor('#FFFFFF');
        $top = 45;
        $bottom = 10;
        $left = 95;
        $right = 15;
        $graph->Set90AndMargin($left, $right, $top, $bottom);
        // Label align for X-axis
        $graph->xaxis->SetLabelAlign('right', 'center', 'right');
        // Label align for Y-axis
        $graph->yaxis->SetLabelAlign('center', 'bottom');
        $graph->xaxis->SetTickLabels($lbl);
        // Titles
        $graph->title->SetFont(FF_FONT1, FS_BOLD, 9.5);
        $title = $C_translate->translate('graph_top', 'account_admin', '');
        $graph->title->Set($title);
        // Create a bar pot
        $bplot = new BarPlot($datay);
        $bplot->SetFillColor("#506DC7");
        $bplot->SetWidth(0.2);
        // Show the values
        $bplot->value->Show();
        $bplot->value->SetFont(FF_FONT1, FS_NORMAL, 8);
        $bplot->value->SetAlign('center', 'center');
        $bplot->value->SetColor("black", "darkred");
        $bplot->value->SetFormat($currency_iso . '%.2f');
        $graph->Add($bplot);
        $graph->Stroke();
        return;
    }
开发者ID:chiranjeevjain,项目名称:agilebill,代码行数:101,代码来源:account_admin.inc.php

示例10: BarPlot

// Set up the title for the graph
/*
$graph->title->Set("$title");
$graph->title->SetFont(FF_FONT1, FS_BOLD, 18);
$graph->title->SetColor("$titlecolor");
*/
// Setup font for axis
$graph->xaxis->SetFont(FF_FONT1, FS_NORMAL, 8);
$graph->yaxis->SetFont(FF_FONT1, FS_NORMAL, 11);
// Show 0 label on Y-axis (default is not to show)
$graph->yscale->ticks->SupressZeroLabel(false);
// Setup X-axis labels
$graph->xaxis->SetTickLabels($datax);
if ($gorientation == "v") {
    $graph->img->SetAngle(90);
    $graph->Set90AndMargin(120, 40, 40, 40);
} else {
    $graph->xaxis->SetLabelAngle(90);
}
//Setup Frame
$graph->SetFrame(true, "#fafafa");
//$graph->SetFrame(false);
// Create the bar pot
$bplot = new BarPlot($datay);
$bplot->SetWidth(0.6);
// Setup color for gradient fill style
$bplot->SetFillColor($color . "@0.3");
//$bplot->SetShadow($color."@0.7",5,5);
// Set color for the frame of each bar
$bplot->SetColor($color . "@1");
$graph->Add($bplot);
开发者ID:jackpf,项目名称:ossim-arc,代码行数:31,代码来源:attack_graph.php

示例11: barHPlot

 private function barHPlot($question, $datax, $datay, $width, $height)
 {
     include_once BASE . "jpgraph.php";
     include_once BASE . "jpgraph_bar.php";
     $tFontSize = 11;
     $xFontSize = 6 + $height / $this->amountOfVariants / 30;
     $maxX = 0;
     foreach ($datax as $x) {
         if (($t = strlen($x)) > $maxX) {
             $maxX = $t;
         }
     }
     for ($i = 0; $i < $this->amountOfVariants; $i++) {
         $x =& $datax[$i];
         if (($t = strlen($x)) >= MAXCHARSPERLINE) {
             $index = strrpos(substr($x, 0, MAXCHARSPERLINE - 1), ' ');
             if ($index === false) {
                 $index = MAXCHARSPERLINE - 3;
             }
             $x[$index] = "\n";
             if ($t > $index + MAXCHARSPERLINE) {
                 $x = substr($x, 0, $index + MAXCHARSPERLINE - 3) . "...";
             }
         }
     }
     unset($x);
     // Set the basic parame graph
     $graph = new Graph($width, $height, 'auto');
     $graph->SetScale("textlin", 0, 100);
     //if (amountOfVariants>5) $xFontSize--;
     $lm = 0;
     foreach ($datax as $x) {
         $linia = strtok($x, "\n");
         while ($linia != '') {
             $t = new Text($linia);
             $t->SetFont(FF_COMIC, FS_NORMAL, $xFontSize);
             $lineWidth = $t->GetWidth($graph->img);
             if ($lineWidth > $lm) {
                 $lm = $lineWidth;
             }
             //echo $linia.$lineWidth."<BR>";
             $linia = strtok("\n");
         }
     }
     // Rotate graph 90 degrees and set margin
     $graph->Set90AndMargin($lm + 10, 20, 40, 30);
     // Set white margin color
     $graph->SetMarginColor('gray@0.95');
     // Setup title
     $graph->title->Set($question);
     $graph->title->SetMargin(10);
     $graph->title->SetFont(FF_VERDANA, FS_BOLD, $tFontSize);
     $tWidth = $graph->title->GetWidth($graph->img);
     //if ($graph->title->GetWidth($graph->img)>$width) $graph->title->SetFont(FF_VERDANA, FS_BOLD, $tFontSize-2);
     if ($tWidth > $width) {
         $index = strrpos(substr($question, 0, ($len = strlen($question)) / 2 + 5), ' ');
         //echo $index;
         if ($index === false) {
             $index = $len / 2 - 3;
         }
         $question[$index] = "\n";
         $graph->title->SetFont(FF_VERDANA, FS_BOLD, $tFontSize -= 2);
         $graph->title->Set($question);
     }
     //$graph->subtitle->Set("(Non optimized)");
     // Setup X-axis
     $graph->xaxis->SetFont(FF_COMIC, FS_NORMAL, $xFontSize);
     $graph->xaxis->SetTickLabels($datax);
     $graph->xaxis->SetColor('black');
     // Some extra margin looks nicer
     $graph->xaxis->SetLabelMargin(10);
     // Label align for X-axis
     $graph->xaxis->SetLabelAlign('right', 'center');
     // Add some grace to y-axis so the bars doesn't go
     // all the way to the end of the plot area
     //$graph->yaxis->scale->SetGrace(5);
     $graph->yaxis->SetPos('max');
     $graph->yaxis->SetLabelAlign('center', 'top');
     $graph->yaxis->SetLabelSide('SIDE_RIGHT');
     $graph->yaxis->SetLabelFormat('%2d%%');
     // Now create a bar pot
     $bplot = new BarPlot($datay);
     $bplot->SetWidth(0.4);
     // We want to display the value of each bar at the top
     $bplot->value->Show();
     $bplot->value->SetFont(FF_VERDANA, FS_BOLD, $xFontSize - 1);
     //$bplot->SetShadow("black@0.1",2,2);
     $bplot->value->SetAlign('right', 'center');
     $bplot->value->SetColor("yellow");
     $bplot->value->SetFormat('%d%%');
     $bplot->value->HideZero();
     $bplot->SetValuePos('max');
     //$graph->SetMarginColor('green');
     // Box around plotarea
     $graph->SetBox();
     $graph->SetFrame();
     $graph->SetShadow();
     // Setup the X and Y grid
     $graph->ygrid->SetFill(true, '#DDDDDD@0.5', '#BBBBBB@0.5');
     $graph->ygrid->SetLineStyle('dashed');
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:phppool,代码行数:101,代码来源:PlotQuestion.php

示例12: array

// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_bar.php';
require_once 'jpgraph/jpgraph_line.php';
// some data
$data_weight = array(120, 130, 123, 100, 150, 160, 170, 200, 220, 240);
$data_fat = array(22, 20, 12, 16, 15, 24, 37, 39, 40, 44);
// Create the graph.
$graph = new Graph(250, 400);
// $graph->SetAngle(90);
// Setup some basic graph parameters
$graph->SetScale("textlin");
$graph->SetY2Scale('lin', 0, 100);
// $graph->img->SetMargin(50,70,30,40);
$graph->Set90AndMargin(40, 40, 60, 40);
$graph->yaxis->SetTitleMargin(30);
$graph->SetMarginColor('#EEEEEE');
// $title = iconv("UTF-8", "gb2312", $title);
// Setup titles and fonts
$graph->title->Set("Health Monitor");
$graph->xaxis->title->Set("T");
$graph->yaxis->title->Set("W");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Turn the tickmarks
$graph->xaxis->SetTickSide(SIDE_DOWN);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->y2axis->SetTickSide(SIDE_RIGHT);
$graph->y2axis->SetColor('black', 'blue');
$graph->y2axis->SetLabelFormat('%2d.0');
// Create a bar pot
开发者ID:devsnippet,项目名称:WeChat-2,代码行数:30,代码来源:index2.php

示例13: generateLog

 public function generateLog($winner = false)
 {
     $gameid = strtotime('now');
     $template = file_get_contents('data/log.html');
     $fp = fopen(sprintf('logs/log_%d.html', $gameid), 'a');
     $htplayers = array();
     foreach ($this->players as $pl) {
         $htplayers[] = sprintf('<li>%s</li>', htmlspecialchars(parent::playerName($pl)));
     }
     $players = implode("\n", $htplayers);
     if ($winner) {
         $data = sprintf("After %d hands played, the player <strong>%s</strong> won the total pot of <strong>\$%0.2f</strong>", $this->game, parent::playerName($winner), $winner->money);
     } else {
         $htplayers = array();
         foreach ($this->players as $pl) {
             $htplayers[] = sprintf('<li>%s ($%0.2f)</li>', htmlspecialchars(parent::playerName($pl)), $pl->money);
         }
         $htplayers = implode("\n", $htplayers);
         $data = sprintf("After %d hands no winner was determined a summary of each individual player's money follows:<ol>%s</ol>", $this->game, $htplayers);
     }
     $template = str_replace("{players}", $players, $template);
     $template = str_replace("{gameid}", $gameid, $template);
     $template = str_replace("{winner}", $data, $template);
     $template = str_replace("{version}", parent::$version, $template);
     $template = str_replace("{date}", date('d-m-Y h:i', $gameid), $template);
     $template = str_replace("{startmoney}", sprintf('%0.2f', $this->playermoney), $template);
     $template = str_replace("{bigblind}", sprintf('%0.2f', $this->bigblind), $template);
     $template = str_replace("{smallblind}", sprintf('%0.2f', $this->smallblind), $template);
     $template = str_replace("{maxgames}", $this->totalgames, $template);
     $template = str_replace("{winner}", $data, $template, $template);
     fputs($fp, $template);
     fclose($fp);
     require_once 'data/jpgraph.php';
     require_once 'data/jpgraph_line.php';
     $width = 900;
     $height = 300;
     $graph = new Graph($width, $height);
     $graph->img->SetMargin(40, 40, 40, 40);
     $graph->SetShadow();
     $graph->setScale('intlin');
     $graph->title->Set('Amount of money per player, per hand');
     $graph->xaxis->title->Set('Hand');
     $graph->yaxis->title->Set('Money');
     foreach ($this->moneylog as $id => $data) {
         $p = $this->players[$id];
         $lineplot = new LinePlot($data);
         $lineplot->setweight($id);
         $lineplot->SetLegend(parent::playerName($p));
         $graph->add($lineplot);
     }
     $graph->stroke(sprintf('logs/playermoney_%d.jpg', $gameid));
     // Pie graph, showing checks, folds, bets, wins, calls and raises
     require_once "data/jpgraph_pie.php";
     // Create the Pie Graph.
     $height = ceil(count($this->players) / 2) * 440;
     $graph = new PieGraph($width, $height);
     $graph->SetShadow();
     // Set A title for the plot
     $graph->title->Set("Moves per user");
     // Create plots
     $size = 0.2;
     $x = array(0.25, 0.75);
     $y = 220;
     $i = 1;
     $legend = array("Check", "Call", "Bet", "Raise", "Fold");
     foreach ($this->players as $id => $player) {
         $plot = new PiePlot(array($player->checks, $player->calls, $player->bets, $player->raises, $player->folds));
         if ($player->id == 1) {
             $plot->SetLegends($legend);
         }
         $plot->SetLabelType(PIE_VALUE_ADJPERCENTAGE);
         $plot->SetSize($size);
         $plot->SetCenter($x[$i - 1], $y);
         if ($i == 2) {
             $i = 0;
             $y += 420;
         }
         $i++;
         $plot->title->Set(parent::playerName($player));
         $graph->add($plot);
     }
     $graph->stroke(sprintf('logs/playermoves_%d.jpg', $gameid));
     // Bargraph containing each player's wins
     $height = 70 * count($this->players);
     require_once "data/jpgraph_bar.php";
     $graph = new Graph($width, $height);
     $graph->SetScale('textlin');
     $graph->SetShadow();
     $lbl = array();
     $data = array();
     foreach ($this->players as $pl) {
         $lbl[] = parent::PlayerName($pl);
         $data[] = $pl->wins;
     }
     $top = 60;
     $bottom = 30;
     $left = 80;
     $right = 30;
     $graph->Set90AndMargin($left, $right, $top, $bottom);
     $graph->xaxis->SetTickLabels($lbl);
//.........这里部分代码省略.........
开发者ID:helmet,项目名称:Aiserver2,代码行数:101,代码来源:holdem.php

示例14: array

// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_bar.php';
require_once 'jpgraph/jpgraph_line.php';
// 数据
$data_follow = array(140, 110, 77, 104, 29, 161, 13, 195);
// 构造对象
$graph = new Graph(320, 440);
//屏幕分辨率
// 基本参数
$graph->SetScale("textlin");
//线性标尺
$graph->SetY2Scale('lin', 0, 100);
//对数
$graph->Set90AndMargin(50, 0, 65, 0);
//旋转90度
$graph->yaxis->SetTitleMargin(25);
// 标题与字体
$graph->title->Set("Scene Analysis");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->Set("Sce");
$graph->yaxis->title->Set("Num");
$graph->y2axis->SetColor('black', 'blue');
$graph->y2axis->SetLabelFormat('%2d');
// 生成柱状图
$bplot = new BarPlot($data_follow);
$bplot->SetFillColor("orange@0.2");
$bplot->SetValuePos('center');
$bplot->value->SetFormat("%d");
$bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9);
开发者ID:devsnippet,项目名称:WeChat-2,代码行数:30,代码来源:index.php

示例15: isset

     $graph->Stroke();
     break;
 case 'balance_bar':
     require_once 'core/jpgraph/jpgraph_bar.php';
     // Get data
     $a = isset($_GET['a']) ? $_GET['a'] : 0;
     $b = isset($_GET['b']) ? $_GET['b'] : 0;
     $c = isset($_GET['c']) ? $_GET['c'] : 0;
     $total = $a + $b + $c;
     $data_a = array($total ? $a * 100.0 / $total : 0);
     $data_b = array($total ? $b * 100.0 / $total : 100);
     $data_c = array($total ? $c * 100.0 / $total : 0);
     // Build graph
     $graph = new Graph(400, 30);
     $graph->SetScale('textlin', 0, 100);
     $graph->Set90AndMargin(1, 1, 1, 1);
     $graph->SetMarginColor('#22262a');
     $graph->SetColor('#22262a');
     $graph->SetFrame(true, '#FFFFFF', 0);
     $bpa = new BarPlot($data_a);
     $bpa->SetFillColor('#CC0000');
     $bpt = new BarPlot($data_b);
     if ($total == 0) {
         $bpt->SetFillColor('#222222');
     } else {
         $bpt->SetFillColor('#888888');
     }
     $bph = new BarPlot($data_c);
     $bph->SetFillColor('#0055FF');
     $accplot = new AccBarPlot(array($bpa, $bpt, $bph));
     $accplot->SetWidth(16);
开发者ID:redrumrobot,项目名称:tremstats,代码行数:31,代码来源:_graph.php


注:本文中的Graph::Set90AndMargin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。