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


PHP pImage::drawRectangle方法代码示例

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


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

示例1: createGraphe

function createGraphe($vData, $hData, $titre, $vLabel, $hLabel)
{
    $MyData = new pData();
    /*Je présente ma série de données à utiliser pour le graphique et je détermine le titre de l'axe vertical avec setAxisName*/
    $MyData->addPoints($vData, "vertical");
    $MyData->setSerieWeight("vertical", 2);
    $MyData->setAxisName(0, $vLabel);
    /*J'indique les données horizontales du graphique. Il doit y avoir le même nombre que pour ma série de données précédentes (logique)*/
    $MyData->addPoints($hData, "horizontal");
    $MyData->setSerieDescription("horizontal", $hLabel);
    $MyData->setAbscissa("horizontal");
    $MyData->setPalette("vertical", array("R" => 255, "G" => 0, "B" => 0));
    /* Je crée l'image qui contiendra mon graphique précédemment crée */
    $myPicture = new pImage(900, 400, $MyData);
    /* Je crée une bordure à mon image */
    $myPicture->drawRectangle(0, 0, 899, 399, array("R" => 0, "G" => 0, "B" => 0));
    /* J'indique le titre de mon graphique, son positionnement sur l'image et sa police */
    $myPicture->setFontProperties(array("FontName" => "./pChart2.1.4/fonts/Forgotte.ttf", "FontSize" => 11));
    $myPicture->drawText(200, 25, $titre, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
    /* Je choisi la font de mon graphique */
    $myPicture->setFontProperties(array("FontName" => "./pChart2.1.4/fonts/pf_arma_five.ttf", "FontSize" => 6));
    /* Je détermine la taille du graphique et son emplacement dans l'image */
    $myPicture->setGraphArea(60, 40, 800, 380);
    /* Paramètres pour dessiner le graphique à partir des deux abscisses */
    $scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => TRUE, "LabelSkip" => 4);
    $myPicture->drawScale($scaleSettings);
    /* Je dessine mon graphique en fonction des paramètres précédents */
    $myPicture->drawAreaChart();
    $myPicture->drawLineChart();
    /* J'indique le chemin où je souhaite que mon image soit créée */
    $myPicture->Render("img/" . $titre . ".png");
}
开发者ID:adib0u,项目名称:Model_math_finance,代码行数:32,代码来源:emprunt.php

示例2: create_common_image

function create_common_image($title, $width, $height, $data, $chart_type = 'line')
{
    global $pchart_path;
    /* Create the pChart object */
    $myPicture = new pImage($width, $height, $data);
    /* Draw the background */
    $Settings = array("R" => 255, "G" => 255, "B" => 255, "Dash" => 1, "DashR" => 185, "DashG" => 225, "DashB" => 255);
    $myPicture->drawFilledRectangle(0, 0, $width, $height, $Settings);
    /* Overlay with a gradient */
    $Settings = array("StartR" => 206, "StartG" => 235, "StartB" => 235, "EndR" => 71, "EndG" => 150, "EndB" => 205, "Alpha" => 50);
    $myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, $Settings);
    $myPicture->drawGradientArea(0, 0, $width, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
    /* Add a border to the picture */
    $myPicture->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
    /* Write the picture title */
    $myPicture->setFontProperties(array("FontName" => $pchart_path . "/fonts/arialbd.ttf", "FontSize" => 9));
    $myPicture->drawText(24, 12, win2uni($title), array("R" => 255, "G" => 255, "B" => 255, "Align" => TEXT_ALIGN_MIDDLELEFT));
    $myPicture->drawFromPNG(4, 4, "includes/design/images/chart_pie.png");
    if ($chart_type == 'line') {
        $myPicture->setFontProperties(array("FontName" => $pchart_path . "/fonts/arial.ttf", "FontSize" => 8));
        /* Draw the scale and the 1st chart */
        $myPicture->setGraphArea(60, 64, 450 + 200, 190);
        $myPicture->drawFilledRectangle(60, 50, 450 + 200, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -255, "Alpha" => 60));
        $myPicture->drawScale(array("Mode" => SCALE_MODE_START0, "DrawSubTicks" => FALSE, "GridR" => 151, "GridG" => 197, "GridB" => 254, "GridAlpha" => 30));
        $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
    }
    $myPicture->setFontProperties(array("FontName" => $pchart_path . "/fonts/pf_arma_five.ttf", "FontSize" => 6));
    return $myPicture;
}
开发者ID:captincook,项目名称:Pony,代码行数:29,代码来源:chart.php

示例3: index

 function index()
 {
     $width = 600;
     $height = 230;
     /* Create and populate the pData object */
     $MyData = new pData();
     $MyData->addPoints(array(-4, VOID, VOID, 12, 8, 3), "Female");
     $MyData->addPoints(array(3, 12, 15, 8, 5, -5), "Male");
     //$MyData->addPoints(array(2,0,5,18,19,22),"Probe 3");
     $MyData->setSerieTicks("Male", 4);
     $MyData->setAxisName(0, "Number of males, females");
     $MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
     $MyData->setSerieDescription("Labels", "Months");
     $MyData->setAbscissa("Labels");
     /* Create the pChart object */
     $myPicture = new pImage($width, $height, $MyData);
     /* Draw the background */
     $Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
     $myPicture->drawFilledRectangle(0, 0, $width, $height, $Settings);
     /* Overlay with a gradient */
     $Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
     $myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, $Settings);
     //$myPicture->drawGradientArea(0,0,700,20,DIRECTION_VERTICAL,array("StartR"=>0,"StartG"=>0,"StartB"=>0,"EndR"=>50,"EndG"=>50,"EndB"=>50,"Alpha"=>80));
     /* Add a border to the picture */
     $myPicture->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
     /* Write the picture title */
     //$myPicture->setFontProperties(array("FontName"=>pClass."fonts/Silkscreen.ttf","FontSize"=>6));
     //$myPicture->drawText(10,13,"drawBarChart() - draw a bar chart",array("R"=>255,"G"=>255,"B"=>255));
     /* Write the chart title */
     $myPicture->setFontProperties(array("FontName" => pClass . "fonts/Forgotte.ttf", "FontSize" => 11));
     $myPicture->drawText(250, 55, "Average time to find a set", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
     /* Draw the scale and the 1st chart */
     $myPicture->setGraphArea(60, 60, 450, 190);
     $myPicture->drawFilledRectangle(60, 60, 450, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
     $myPicture->drawScale(array("DrawSubTicks" => TRUE));
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     $myPicture->setFontProperties(array("FontName" => pClass . "fonts/pf_arma_five.ttf", "FontSize" => 10));
     $myPicture->drawBarChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO, "Rounded" => TRUE, "Surrounding" => 30));
     //$myPicture->drawBarChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO,"Surrounding"=>30));
     $myPicture->setShadow(FALSE);
     /* Draw the scale and the 2nd chart */
     /*
     $myPicture->setGraphArea(500,60,670,190);
     $myPicture->drawFilledRectangle(500,60,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
     $myPicture->drawScale(array("Pos"=>SCALE_POS_TOPBOTTOM,"DrawSubTicks"=>TRUE));
     $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
     $myPicture->drawBarChart();
     $myPicture->setShadow(FALSE);
     */
     /* Write the chart legend */
     //$myPicture->drawLegend(510,205,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
     $myPicture->drawLegend(500, 105, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
     /* Render the picture (choose the best way) */
     $myPicture->stroke();
 }
开发者ID:BGCX067,项目名称:facebook-slt-svn-to-git,代码行数:55,代码来源:avgtime.php

示例4: RenderValueChart

function RenderValueChart(&$debug2)
{
    $conditions = [["BETWEEN 1 AND 19"], ["BETWEEN 20 AND 49"], ["BETWEEN 50 AND 99"], ["BETWEEN 100 AND 199"], ["BETWEEN 200 AND 299"], ["BETWEEN 300 AND 499"], ["BETWEEN 500 AND 999"], ["> 999"]];
    $label = ["1-19", "20-49", "50-99", "100-199", "200-299", "300-499", "500-999", ">1000"];
    coinValueCount($conditions, $array_result);
    /* Create and populate the pData object */
    $MyData = new pData();
    $MyData->addPoints($array_result, "Värde (kr)");
    $MyData->setAxisName(0, "Antal");
    $MyData->addPoints($label, "Months");
    $MyData->setSerieDescription("Months", "Month");
    $MyData->setAbscissa("Months");
    /* Create the cache object */
    $myCache1 = new pCache(array("CacheFolder" => PCHART_PATH . "/class/cache"));
    /* Compute the hash linked to the chart data */
    $ChartHash1 = $myCache1->getHash($MyData);
    /* Test if we got this hash in our cache already */
    if ($myCache1->isInCache($ChartHash1)) {
        /* If we have it, get the picture from the cache! */
        $myCache1->saveFromCache($ChartHash1, WWW_PATH . "/tmp/valuechart.png");
        $debug2 = "Old image";
    } else {
        /* Create the pChart object */
        $myPicture = new pImage(700, 400, $MyData);
        /* Turn of Antialiasing */
        $myPicture->Antialias = TRUE;
        /* Add a border to the picture */
        $myPicture->drawRectangle(0, 0, 699, 399, array("R" => 0, "G" => 0, "B" => 0));
        /* Set the default font */
        $myPicture->setFontProperties(array("FontName" => PCHART_PATH . "/fonts/Forgotte.ttf", "FontSize" => 15, "R" => 80, "G" => 80, "B" => 80));
        /* Define the chart area */
        $myPicture->setGraphArea(60, 40, 650, 350);
        /* Draw the scale */
        $scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "Mode" => SCALE_MODE_START0);
        $myPicture->drawScale($scaleSettings);
        /* Write the chart legend */
        $myPicture->drawLegend(340, 12, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
        /* Turn on shadow computing */
        $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
        /* Draw the chart */
        $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
        $settings = array("Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "DisplayR" => 255, "DisplayG" => 255, "DisplayB" => 255, "DisplayShadow" => TRUE, "Surrounding" => 10);
        $myPicture->drawBarChart();
        /* Push the rendered picture to the cache */
        $myCache1->writeToCache($ChartHash1, $myPicture);
        /* Render the picture (choose the best way) */
        $myPicture->Render(WWW_PATH . "/tmp/valuechart.png");
        $debug2 = "Picture rendered";
    }
}
开发者ID:noler,项目名称:CoinBase,代码行数:50,代码来源:chart_functions.php

示例5: buildPicture

 protected function buildPicture(pData $data, $options = array())
 {
     $title_height = isset($options['title_height']) ? $options['title_height'] : 50;
     $ga_height = isset($options['chart_area_height']) ? $options['chart_area_height'] : 310;
     $x_label_height = isset($options['x_label_height']) ? $options['x_label_height'] : 50;
     $height = $title_height + $ga_height + $x_label_height;
     $width = 900;
     // Color scheme from kuler "Q10 Chart"
     $myPicture = new pImage($width, $height, $data);
     $myPicture->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
     $myPicture->setFontProperties(array("FontName" => sfConfig::get('sf_web_dir') . "/fonts/Ubuntu-R.ttf", "FontSize" => 14));
     $TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 40, "G" => 40, "B" => 43);
     $myPicture->drawText($width / 2, $title_height / 2, $this->getOption('title'), $TextSettings);
     $myPicture->setShadow(FALSE);
     $myPicture->setGraphArea(90, 50, 649, $ga_height);
     $myPicture->setFontProperties(array("R" => 40, "G" => 40, "B" => 43, "FontName" => sfConfig::get('sf_web_dir') . "/fonts/DejaVuSans-ExtraLight.ttf", "FontSize" => 9));
     return $myPicture;
 }
开发者ID:rbolliger,项目名称:otokou,代码行数:19,代码来源:ChartBuilderPChart.class.php

示例6: ring2d

function ring2d($x, $y, $name)
{
    $MyData = new pData();
    $MyData->addPoints($x, "ScoreA");
    $MyData->setSerieDescription("ScoreA", "Application A");
    /* Define the absissa serie */
    $MyData->addPoints($y, "Labels");
    $MyData->setAbscissa("Labels");
    /* Create the pChart object */
    $myPicture = new pImage(500, 250, $MyData);
    /* Draw a solid background */
    $Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
    $myPicture->drawFilledRectangle(0, 0, 500, 500, $Settings);
    /* Overlay with a gradient */
    $Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
    $myPicture->drawGradientArea(0, 0, 500, 500, DIRECTION_VERTICAL, $Settings);
    $myPicture->drawGradientArea(0, 0, 500, 30, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
    /* Add a border to the picture */
    $myPicture->drawRectangle(0, 0, 500, 250, array("R" => 0, "G" => 0, "B" => 0));
    /* Write the picture title */
    $myPicture->setFontProperties(array("FontName" => "mod/pchart/fonts/verdana.ttf", "FontSize" => 12));
    $myPicture->drawText(15, 20, $name, array("R" => 255, "G" => 255, "B" => 255));
    /* Set the default font properties */
    $myPicture->setFontProperties(array("FontName" => "mod/pchart/fonts/verdana.ttf", "FontSize" => 12, "R" => 80, "G" => 80, "B" => 80));
    /* Enable shadow computing */
    $myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 50));
    /* Create the pPie object */
    $PieChart = new pPie($myPicture, $MyData);
    /* Draw an AA pie chart */
    $PieChart->draw2DRing(390, 140, array("WriteValues" => TRUE, "ValueR" => 255, "ValueG" => 255, "ValueB" => 255, "Border" => TRUE));
    /* Write the legend box */
    $myPicture->setShadow(FALSE);
    $PieChart->drawPieLegend(10, 50, array("Alpha" => 20));
    /* Render the picture (choose the best way) */
    $myPicture->autoOutput("2dring.png");
}
开发者ID:ut8ia,项目名称:proBase,代码行数:36,代码来源:graf.php

示例7: pData

include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(2, 7, 5, 18, 19, 22, 23, 25, 22, 12, 10, 10), "DEFCA");
$MyData->setAxisName(0, "\$ Incomes");
$MyData->setAxisDisplay(0, AXIS_FORMAT_CURRENCY);
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
$MyData->setPalette("DEFCA", array("R" => 55, "G" => 91, "B" => 127));
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 220, "StartG" => 220, "StartB" => 220, "EndR" => 255, "EndG" => 255, "EndB" => 255, "Alpha" => 100));
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 200, "G" => 200, "B" => 200));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(60, 35, "2k9 Average Incomes", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMLEFT));
/* Do some cosmetic and draw the chart */
$myPicture->setGraphArea(60, 40, 670, 190);
$myPicture->drawFilledRectangle(60, 40, 670, 190, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$myPicture->drawScale(array("GridR" => 180, "GridG" => 180, "GridB" => 180));
/* Draw a spline chart on top */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawFilledSplineChart();
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawSplineChart();
$myPicture->setShadow(FALSE);
/* Write the chart legend */
$myPicture->drawLegend(643, 210, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.drawSimple.php

示例8: pImage

    $venku = $row["value"] == NULL ? VOID : $row["value"];
    $myData->addPoints($venku, "value");
}
$myData->setSerieWeight("value", 1.5);
$myData->setAxisName(0, "Teplota");
$myData->setAxisUnit(0, "°C");
/* Create the abscissa serie */
$myData->setAbscissa("time");
//set the x line
//$myData->setAbscissaName("Den");
//$myData->setXAxisDisplay(AXIS_FORMAT_DATE);
$myPicture = new pImage($Graphwidth, $Graphheigth, $myData);
$Settings = array("R" => 240, "G" => 240, "B" => 240);
$myPicture->setFontProperties(array("FontName" => $LibPath . "fonts/verdana.ttf", "FontSize" => 8));
$myPicture->drawFilledRectangle(0, 0, $Graphwidth, $Graphheigth, $Settings);
$myPicture->drawRectangle(0, 0, $Graphwidth, $Graphheigth, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawRectangle(0, 0, $Graphwidth - 1, $Graphheigth - 1, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(50, 30, $Graphwidth - 70, $Graphheigth - 40);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => $LibPath . "fonts/verdana.ttf", "FontSize" => 8));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
$Settings = array("Mode" => SCALE_MODE_FLOATING, "DrawSubTicks" => TRUE, "DrawArrows" => TRUE, "ArrowSize" => 6, "Pos" => SCALE_POS_LEFTRIGHT, "LabelSkip" => 0, "SkippedInnerTickWidth" => 10, "LabelingMethod" => LABELING_ALL, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 20, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 20, "LabelRotation" => 90, "DrawXLines" => 1, "DrawSubTicks" => 0, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 20, "DrawYLines" => ALL);
$myPicture->drawScale($Settings);
$Config = array("DisplayValues" => 0, "AroundZero" => 0, "BreakVoid" => 1, "RecordImageMap" => FALSE);
$GraphType = 'SplineChart';
switch ($GraphType) {
    case 'AreaChart':
        $myPicture->drawAreaChart($Config);
        break;
    case 'FilledSplineChart':
开发者ID:nakoukal,项目名称:raspi_www,代码行数:31,代码来源:render_graph.php

示例9: pImage

/* CAT:Drawing */
/* pChart library inclusions */
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create the pChart object */
$myPicture = new pImage(700, 230);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 700, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawRectangle() - Transparency & colors", array("R" => 255, "G" => 255, "B" => 255));
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw a rectangle */
$RectangleSettings = array("R" => 181, "G" => 209, "B" => 27, "Alpha" => 100);
$myPicture->drawRectangle(20, 60, 400, 170, $RectangleSettings);
/* Draw a rectangle */
$RectangleSettings = array("R" => 209, "G" => 134, "B" => 27, "Alpha" => 30);
$myPicture->drawRectangle(30, 30, 200, 200, $RectangleSettings);
/* Draw a rectangle */
$RectangleSettings = array("R" => 209, "G" => 31, "B" => 27, "Alpha" => 100);
$myPicture->drawRectangle(480, 50, 650, 80, $RectangleSettings);
/* Draw a rectangle */
开发者ID:josepabloapu,项目名称:statistical-analysis-tools-lamp,代码行数:30,代码来源:example.drawRectangle.php

示例10: drawBarChart

 protected function drawBarChart(ChartDataset $CDs)
 {
     if (!extension_loaded("gd") && !extension_loaded("gd2")) {
         /* Extension not loaded */
         // NO BARCHARTS AND ERRORS FOR YOU!
         return;
     }
     /* Create and populate the pData object */
     $MyData = new pData();
     if (empty($CDs->data)) {
         return;
     }
     //print_r($CDs->data);
     foreach ($CDs->data as $points) {
         //print_r($points);
         $MyData->addPoints($points["points"], $points["label"]);
     }
     $MyData->setAxisName(0, "Amount Sold");
     $MyData->setSerieDescription($points["label"], $points["label"]);
     $MyData->setAbscissa($points["label"]);
     /* Create the pChart object */
     $myPicture = new pImage(1000, 230, $MyData);
     // the horrible way to add fonts is just one bunch of fucked up shit, not making sense. bullshit parameters and paths.
     //$myPicture->setFontProperties(array("FontName"=>"Bedizen"));
     $myPicture->setFontProperties(array("FontName" => "pChart2.1.4//fonts/calibri.ttf", "FontSize" => 11));
     //print_r(is_file("C:/xampp_jan2015/htdocs/hackerbar/web/fonts/GeosansLight.ttf"));
     /* Turn of Antialiasing */
     $myPicture->Antialias = false;
     /* Add a border to the picture */
     $myPicture->drawGradientArea(0, 0, 1000, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
     $myPicture->drawGradientArea(0, 0, 1000, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
     $myPicture->drawRectangle(0, 0, 999, 229, array("R" => 0, "G" => 0, "B" => 0));
     /* Set the default font */
     //$myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6));
     /* Define the chart area */
     $myPicture->setGraphArea(60, 40, 850, 200);
     /* Draw the scale */
     $scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
     $myPicture->drawScale($scaleSettings);
     /* Write the chart legend */
     $myPicture->drawLegend(860, 25, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
     /* Turn on shadow computing */
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     /* Draw the chart */
     $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
     $settings = array("Surrounding" => -30, "InnerSurrounding" => 30);
     $myPicture->drawBarChart($settings);
     /* Render the picture (choose the best way) */
     $myPicture->autoOutput("images/barcharts/" . $points["label"] . ".png");
     //$myPicture->auto
     $myPicture->render("myfile.png");
 }
开发者ID:stitch,项目名称:HackerBar,代码行数:52,代码来源:popularProductHistoryBarchart.php

示例11: drawImage

 public function drawImage()
 {
     $qr_result = $this->values;
     //var_dump($qr_result);die();
     $va_columns = $this->parameters["columns"];
     $width = $this->parameters["width"];
     $format = $this->parameters["format"];
     $va_charting_columns = $this->parameters["charting_columns"];
     $va_chart_types = $this->parameters["chart_types"];
     $qr_result->seek();
     if ($qr_result->numRows() == 0) {
         //if no result nothing to do
         return false;
     }
     // Loading chart format specifications
     // TODO : this coding part should be out of this function, sending values in 1 parameter
     if (is_array($va_chart_types)) {
         foreach ($va_chart_types as $type => $settings) {
             if ($type == $format) {
                 $chart_type = $settings["googletype"];
                 $message = $settings["message"];
             }
         }
     }
     /* Create and populate the pData object */
     $MyData = new pData();
     // Fulfillment of the results
     $va_row_no = 0;
     $va_content = array();
     while ($qr_result->nextRow()) {
         $va_column_no = 0;
         foreach ($va_columns as $va_column => $va_column_label) {
             // only render columns specified in XML field charting_columns
             if (in_array($va_column_label, $va_charting_columns)) {
                 $va_content[$va_column_label][$va_row_no] = $qr_result->get($va_column_label);
                 $va_column_no++;
             }
         }
         $va_row_no++;
     }
     //var_dump($va_content);
     $va_row_no = 0;
     foreach ($va_charting_columns as $va_column_label) {
         //print "MyData->addPoints(\"".implode("\",\"",$va_content[$va_column_label])."\",\"".$va_column_label."\");<br/>";
         $MyData->addPoints($va_content[$va_column_label], $va_column_label);
         if ($va_row_no == 0) {
             //print "MyData->setAbscissa(\"Labels\")<br/>";
             $MyData->setAbscissa($va_column_label);
         } else {
             //print "MyData->setSerieDescription(\"".$va_column_label."\",\"".$va_column_label."\");<br/>";
             $MyData->setSerieDescription($va_column_label, $va_column_label);
         }
         $va_row_no++;
     }
     /* Create the pChart object */
     $myPicture = new pImage($width, $width / 2, $MyData);
     /* Set the common properties */
     $myPicture->setFontProperties(array("FontName" => __CA_STATISTICSVIEWER_CLASS_DIR__ . "/fonts/verdana.ttf", "FontSize" => 0.014 * $width, "R" => 80, "G" => 80, "B" => 80));
     $RectangleSettings = array("R" => 200, "G" => 200, "B" => 200);
     $myPicture->drawRectangle(1, 1, $width - 1, $width / 2 - 1, $RectangleSettings);
     $myPicture->setGraphArea($width / 9, $width / 10, $width * 0.75, $width * 0.4);
     // if not pie, draw the legend
     if ($format != "pie") {
         $myPicture->drawLegend($width * 0.8, $width * 0.05, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
     }
     switch ($format) {
         case "bar":
             $myPicture->drawScale(array("Pos" => SCALE_POS_TOPBOTTOM, "DrawSubTicks" => FALSE, "RemoveYAxis" => TRUE, "GridAlpha" => 90, "DrawXLines" => FALSE));
             $myPicture->drawBarChart();
             break;
         case "column":
             $myPicture->drawScale(array("DrawSubTicks" => FALSE, "RemoveYAxis" => TRUE, "GridAlpha" => 90, "DrawXLines" => FALSE));
             $myPicture->drawBarChart();
             break;
         case "step":
             $myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
             $myPicture->drawStepChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
             break;
         case "area":
             $myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
             $myPicture->drawAreaChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
             break;
         case "pie":
             $PieChart = new pPie($myPicture, $MyData);
             $PieChart->draw2DPie(0.4 * $width, 0.25 * $width, array("WriteValues" => PIE_VALUE_PERCENTAGE, "ValueR" => 95, "ValueG" => 95, "ValueB" => 95, "ValuePadding" => 0.03 * $width, "Radius" => 0.16 * $width, "SecondPass" => TRUE, "Border" => TRUE, "Precision" => 0));
             $myPicture->setShadow(FALSE);
             $myPicture->setFontProperties(array("FontName" => __CA_STATISTICSVIEWER_CLASS_DIR__ . "/fonts/verdana.ttf", "FontSize" => 0.018 * $width, "R" => 80, "G" => 80, "B" => 80));
             $PieChart->drawPieLegend(0.8 * $width, 0.05 * $width, array("Style" => LEGEND_NOBORDER, "BoxSize" => $width / 60, "FontR" => 0, "FontG" => 0, "FontB" => 0));
             break;
         case "line":
         default:
             $myPicture->drawScale(array("DrawXLines" => FALSE, "DrawYLines" => ALL, "GridR" => 127, "GridG" => 127, "GridB" => 127));
             $myPicture->drawLineChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
             break;
     }
     /* Render the picture (choose the best way) */
     $myPicture->autoOutput();
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:98,代码来源:chartpChartClass.php

示例12: pData

include "generateData.php";
$LongueurGraph = 2000;
$HauteurGraph = 1000;
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($NbSuicide, "Nombre de suicides");
$MyData->setAxisName(0, "Nombre de suicides");
$MyData->addPoints($NbAxe, "Numéro de l'expérience");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Numéro de l'expérience");
/* Create the pChart object */
$myPicture = new pImage($LongueurGraph + 100, $HauteurGraph + 30, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = TRUE;
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, $LongueurGraph + 99, $HauteurGraph + 29, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "./pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, $LongueurGraph + 50, $HauteurGraph);
/* Draw the scale */
$scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend($LongueurGraph, 12, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$settings = array("Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "DisplayR" => 255, "DisplayG" => 255, "DisplayB" => 255, "DisplayShadow" => TRUE, "Surrounding" => 10);
$myPicture->drawBarChart();
开发者ID:yofun,项目名称:TAI_Probabilites,代码行数:31,代码来源:generateGraph.php

示例13: array

$MyData->createFunctionSerie("Serie 3", "(z*15)*z", array("AutoDescription" => TRUE, "MinX" => -10, "MaxX" => 10, "XStep" => 1));
$MyData->setAxisName(0, "functions");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay some gradients */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(540, 0, 700, 30, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawRectangle(540, 0, 699, 31, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 20));
$myPicture->drawText(110, 35, "Functions computing", array("Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Turn on shadows */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.createFunctionSerie.php

示例14: pData

require_once 'pChart/class/pDraw.class.php';
require_once 'pChart/class/pImage.class.php';
require_once 'pChart/class/pData.class.php';
require_once 'pChart/class/pPie.class.php';
// Exemplo extraido do site da lib
// precisamos ter dados para montar os gráficos
$DataSet = new pData();
// Adicionando os pontos de um gráfico de pizza
// horas de trabalho na semana
$DataSet->addPoints(array(45, 30, 40), "Serie1");
// valores
$DataSet->setSerieDescription("Serie1", "Horas Trabalhadas");
$DataSet->addPoints(array("João", 'Pedro', 'Manuel'), "Labels");
$DataSet->setAbscissa("Labels");
// Inicializando o gráfico - Largura e Altura
$Graph = new pImage(450, 230, $DataSet);
$Graph->setFontProperties(array('FontName' => "pChart/fonts/verdana.ttf", 'FontSize' => 10));
// Desenha dois retangulo arredondado
$settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$Graph->drawFilledRectangle(0, 0, 300, 300, $settings);
$Graph->drawRectangle(0, 0, 299, 259, array("R" => 0, "G" => 0, "B" => 0));
$Graph->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 50));
$PieChart = new pPie($Graph, $DataSet);
$PieChart->draw2DPie(160, 140, array("DrawLabels" => TRUE, "LabelStacked" => TRUE, "Border" => TRUE));
/* Caixa de legenda */
$Graph->setShadow(FALSE);
$PieChart->drawPieLegend(15, 40, array("Alpha" => 20));
// Cria a imagem e salva em arquivo
//$Graph->autoOutput("/tmp/teste.png");
// Cria a imagem e devolve para o browser
$Graph->autoOutput();
开发者ID:TiagoRodrigoLima,项目名称:gerencia-net-php-essentials,代码行数:31,代码来源:pizza.php

示例15: pData

 }
 $overUnder = $position == 'ABOVE' ? '70% or more' : 'less than 70%';
 $ctitle = $result->Question__c;
 $data = new pData();
 $bdat = array(array(0 => $result->Benchmark_High, 1 => $result->Benchmark_High, 2 => $result->Benchmark_High, 3 => $result->Benchmark_High, 4 => $result->Benchmark_High, 5 => $result->Benchmark_High), array(0 => $result->Benchmark_Low, 1 => $result->Benchmark_Low, 2 => $result->Benchmark_Low, 3 => $result->Benchmark_Low, 4 => $result->Benchmark_Low, 5 => $result->Benchmark_Low));
 $data->addPoints(array($result->Prior_Year, $result->Response__c, $result->Peer_Median, $result->Group_Median__c), "series1");
 $data->setSerieTicks("series1", 4);
 $data->addPoints(array("Your 2009\npercentage", "Your 2010\npercentage", "Median percentage \namong other companies \nwith {$overUnder} of \ntheir technical workforce\nin engineering, R&D, and \ntechnical design, 2010", "Median percentage among\nall other participating\ncompanies, 2010"), "Labels");
 $data->setAbscissa("Labels");
 /* Create the pChart object */
 $myPicture = new pImage(700, 450, $data);
 /* Create a solid background */
 $Settings = array("R" => 242, "G" => 242, "B" => 242);
 $myPicture->drawFilledRectangle(0, 0, 700, 450, $Settings);
 /* Add a border to the picture */
 $myPicture->drawRectangle(0, 0, 699, 449, array("R" => 102, "G" => 102, "B" => 102));
 /* Write the picture title */
 $myPicture->setFontProperties(array("FontName" => "../pChart/fonts/verdana.ttf", "FontSize" => 11));
 $myPicture->drawText(50, 28, $ctitle, array("R" => 69, "G" => 43, "B" => 135));
 //rgb(69,43,135)
 /* Draw the scale */
 $myPicture->setFontProperties(array("FontName" => "../pChart/fonts/verdana.ttf", "FontSize" => 8));
 $myPicture->setGraphArea(50, 60, 670, 340);
 $myPicture->drawFilledRectangle(50, 60, 670, 340, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
 $axisBoundaries = array(0 => array("Min" => 0, "Max" => $yaxis - 1));
 $scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawXLines" => FALSE, "MinDivHeight" => 50, "DrawSubTicks" => FALSE, "CycleBackground" => TRUE, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $axisBoundaries);
 $myPicture->drawScale($scaleSettings);
 /* Graph title */
 //$myPicture->setFontProperties(array("FontName"=>"../pChart/fonts/Forgotte.ttf","FontSize"=>11));
 //$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
 //$myPicture->drawText(50,52,"Chart subtitle",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
开发者ID:redsummit,项目名称:anitaborg,代码行数:31,代码来源:charts.php


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