本文整理汇总了PHP中pImage::drawFilledRectangle方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::drawFilledRectangle方法的具体用法?PHP pImage::drawFilledRectangle怎么用?PHP pImage::drawFilledRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pImage
的用法示例。
在下文中一共展示了pImage::drawFilledRectangle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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();
}
示例3: 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");
}
示例4: pImage
<?php
/* 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);
示例5: rand
for ($i = 0; $i <= 10; $i = $i + 0.2) {
$MyData->addPoints(log($i + 1) * 10, "Bounds 1");
$MyData->addPoints(log($i + 3) * 10 + rand(0, 2) - 1, "Probe 1");
$MyData->addPoints(log($i + 6) * 10, "Bounds 2");
$MyData->addPoints($i * 10, "Labels");
}
$MyData->setAxisName(0, "Size (cm)");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
$MyData->setAbscissaName("Time (years)");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw the background and the border */
$myPicture->drawFilledRectangle(0, 0, 699, 229, array("R" => 200, "G" => 200, "B" => 200));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 220, "StartG" => 220, "StartB" => 220, "EndR" => 100, "EndG" => 100, "EndB" => 100, "Alpha" => 30));
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Size by time generations", array("FontSize" => 20, "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(40, 40, 680, 200);
/* Draw the scale */
$scaleSettings = array("LabelSkip" => 4, "XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridAlpha" => 30, "GridR" => 140, "GridG" => 140, "GridB" => 140, "DrawSubTicks" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line chart */
示例6: pImage
//$myData->setSerieOnAxis("Serie2",0);
//
//$myData->addPoints(array(16,46,-32,35,32,-15,40,29),"Serie3");
//$myData->setSerieDescription("Serie3","Serie 3");
//$myData->setSerieOnAxis("Serie3",0);
$myData->setAxisPosition(0, AXIS_POSITION_LEFT);
$myData->setAxisName(0, "Notas");
$myData->setAxisUnit(0, "");
$myData->addPoints(array("1er Trimestre", "2ndo Trimestre", "3er Trimestre"), "Absissa");
$myData->setAbscissa("Absissa");
//$myData->addPoints(array("1","2","3"),"Labels");
//$myData->setSerieDescription("Labels","Evaluaciones");
//$myData->setAbscissa("Labels");
$myPicture = new pImage($anchura, $altura, $myData);
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, $anchura, $altura, $Settings);
if ($g_enabled == "on") {
list($StartR, $StartG, $StartB) = extractColors($g_gradient_start);
list($EndR, $EndG, $EndB) = extractColors($g_gradient_end);
$Settings = array("StartR" => $StartR, "StartG" => $StartG, "StartB" => $StartB, "EndR" => $EndR, "EndG" => $EndG, "EndB" => $EndB, "Alpha" => 50);
//$Settings = array("StartR"=>125, "StartG"=>92, "StartB"=>231, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
if ($g_direction == "vertical") {
$myPicture->drawGradientArea(0, 0, $anchura, $altura, DIRECTION_VERTICAL, $Settings);
} else {
$myPicture->drawGradientArea(0, 0, $anchura, $altura, DIRECTION_HORIZONTAL, $Settings);
}
} else {
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, $anchura, $altura, DIRECTION_VERTICAL, $Settings);
}
$myPicture->drawRectangle(0, 0, $anchura - 1, $altura - 1, array("R" => 0, "G" => 0, "B" => 0));
示例7: pImage
<?php
/* 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, "drawFilledRectangle() - Transparency & colors", array("R" => 255, "G" => 255, "B" => 255));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw a customized filled rectangle */
$RectangleSettings = array("R" => 150, "G" => 200, "B" => 170, "Dash" => TRUE, "DashR" => 170, "DashG" => 220, "DashB" => 190, "BorderR" => 255, "BorderG" => 255, "BorderB" => 255);
$myPicture->drawFilledRectangle(20, 60, 400, 170, $RectangleSettings);
/* Draw a customized filled rectangle */
$RectangleSettings = array("R" => 209, "G" => 134, "B" => 27, "Alpha" => 30);
$myPicture->drawFilledRectangle(30, 30, 200, 200, $RectangleSettings);
/* Draw a customized filled rectangle */
$RectangleSettings = array("R" => 209, "G" => 31, "B" => 27, "Alpha" => 100, "Surrounding" => 30);
$myPicture->drawFilledRectangle(480, 50, 650, 80, $RectangleSettings);
示例8: pImage
/* Create the pChart object */
$myPicture = new pImage($width, $height, $myData);
/* Turn of Antialiasing */
$myPicture->Antialias = TRUE;
$myPicture->setFontProperties(array("FontName" => "./fonts/simhei.ttf", "FontSize" => $font_t, "R" => 0, "G" => 0, "B" => 0));
/* Draw the background */
$bgcolor = array("R" => 180, "G" => 180, "B" => 180);
$scaleRGB = array("GridR" => 200, "GridG" => 200, "GridB" => 200);
if ($bg == 0) {
$myPicture->drawRectangle(1, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
} else {
if ($bg == 1) {
if (isset($palette)) {
$bgcolor = $palette['bgcolor'];
}
$myPicture->drawFilledRectangle(3, 0, $width - 1, $height - 4, array("R" => $bgcolor['R'], "G" => $bgcolor['G'], "B" => $bgcolor['B'], "Dash" => 0, "DashR" => 255, "DashG" => 255, "DashB" => 255));
$myPicture->drawRectangle(3, 0, $width - 1, $height - 4, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawFilledRectangle(0, 3, $width - 4, $height - 1, array("R" => 255, "G" => 255, "B" => 255, "Alpha" => 90));
$myPicture->drawRectangle(0, 3, $width - 4, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
$scaleRGB = array("GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10);
} else {
if ($bg == 2) {
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 80, "EndG" => 80, "EndB" => 80, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 80, "EndG" => 80, "EndB" => 80, "Alpha" => 20));
$myPicture->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setFontProperties(array("FontName" => "./fonts/msyh.ttf", "FontSize" => $font_t, "R" => 0, "G" => 0, "B" => 0));
$scaleRGB = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "GridAlpha" => 100);
} else {
if ($bg == 3) {
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
示例9: pData
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));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawSimple.png");
示例10: pImage
//$MyData->addPoints(array("8h","10h","12h","14h","16h","18h"),"Time");
$MyData->setAbscissa("Time");
//$MyData->setAxisName(0,"Price in BTC");
//$MyData->setSerieDescription("Time","Hour of the day");
/* Create the pChart object */
$myPicture = new pImage($xsize, $ysize, $MyData);
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, $xsize, $ysize, DIRECTION_VERTICAL, $Settings);
/* Draw the border */
$myPicture->drawRectangle(0, 0, $xsize - 1, $ysize - 1, array("R" => 0, "G" => 0, "B" => 0));
/* Write the title */
$myPicture->setFontProperties(array("FontName" => "../../fonts/verdana.ttf", "FontSize" => 9));
$myPicture->drawText(70, 45, $title, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMLEFT));
/* Draw the 1st scale */
$myPicture->setGraphArea(70, 60, $xsize - 40, $ysize - 30);
$myPicture->drawFilledRectangle(70, 60, $xsize - 40, $ysize - 30, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
$AxisBoundaries = array(0 => array("Min" => $minscale, "Max" => $maxscale));
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries));
/* Draw the 1st stock chart */
$mystockChart = new pStock($myPicture, $MyData);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 30));
$mystockChart->drawStockChart();
/* Reset the display mode because of the graph small size */
//$MyData->setAxisDisplay(0,AXIS_FORMAT_DEFAULT);
/* Draw the 2nd scale */
//$myPicture->setShadow(FALSE);
//$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));
/* Draw the 2nd stock chart */
//$mystockChart = new pStock($myPicture,$MyData);
示例11: generateGraphByStatus
function generateGraphByStatus($periodData, $periods, $statuses)
{
global $configArray;
global $interface;
$reportData = new pData();
//Add points for each status
$periodsFormatted = array();
foreach ($statuses as $status => $statusLabel) {
$statusData = array();
foreach ($periodData as $date => $periodInfo) {
$periodsFormatted[$date] = date('M-d-Y', $date);
$statusData[$date] = isset($periodInfo[$status]) ? $periodInfo[$status] : 0;
}
$reportData->addPoints($statusData, $status);
}
$reportData->setAxisName(0, "Number of files");
$reportData->addPoints($periodsFormatted, "Dates");
$reportData->setAbscissa("Dates");
/* Create the pChart object */
$myPicture = new pImage(700, 290, $reportData);
/* Draw the background */
$Settings = array("R" => 225, "G" => 225, "B" => 225);
$myPicture->drawFilledRectangle(0, 0, 700, 290, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 289, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setFontProperties(array("FontName" => "sys/pChart/Fonts/verdana.ttf", "FontSize" => 9));
$myPicture->setGraphArea(50, 30, 670, 190);
//$myPicture->drawFilledRectangle(30,30,670,150,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "LabelRotation" => 90));
$myPicture->setFontProperties(array("FontName" => "sys/pChart/Fonts/verdana.ttf", "FontSize" => 9));
$myPicture->drawLineChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
/* Write the chart legend */
$myPicture->drawLegend(80, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$chartHref = "/images/charts/eContentImportSummaryByStatus" . time() . ".png";
$chartPath = $configArray['Site']['local'] . $chartHref;
$myPicture->render($chartPath);
$interface->assign('chartByStatus', $chartHref);
}
示例12: buildgraph
function buildgraph($MyData, $xsize, $ysize, $title, $minscale, $maxscale, $date, $type, $imagefilename)
{
//include("../cfg/nmcgraph_cfg.php");
/* Create and populate the pData object */
$MyData = new pData();
load_nmc_data($MyData, $date, $type, $minscale, $maxscale);
//var_dump($MyData);
//echo $minscale." ".$maxscale; exit;
//printf("minscale: $minscale maxscale: $maxscale <br />\n");
//buildgraph( $MyData, $xsize, $ysize, $title );
$MyData->setAxisDisplay(0, AXIS_FORMAT_CURRENCY, "฿");
//$MyData->addPoints(array("8h","10h","12h","14h","16h","18h"),"Time");
//$MyData->setAbscissa("Months");
//$MyData->setAxisName(0,"Price in BTC");
//$MyData->setSerieDescription("Time","Hour of the day");
/* Create the pChart object */
$myPicture = new pImage($xsize, $ysize, $MyData);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, $xsize, $ysize, $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, $xsize, $ysize, DIRECTION_VERTICAL, $Settings);
/* Draw the border */
$myPicture->drawRectangle(0, 0, $xsize - 1, $ysize - 1, array("R" => 0, "G" => 0, "B" => 0));
/* Write the title */
$myPicture->setFontProperties(array("FontName" => dirname(__FILE__) . "/../../fonts/verdana.ttf", "FontSize" => 9));
$myPicture->drawText(70, 45, $title, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMLEFT));
/* Draw the 1st scale */
$myPicture->setGraphArea(70, 60, $xsize - 40, $ysize - 30);
$myPicture->drawFilledRectangle(70, 60, $xsize - 40, $ysize - 30, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 10));
// Y scale
$AxisBoundariesY = array(0 => array("Min" => $minscale, "Max" => $maxscale));
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundariesY));
//X scale
//$AxisBoundariesX = array("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23");
//$MyData->setSerieDescription("Labels","Months");
//$MyData->setAbscissa("Labels");
$MyData->setXAxisDisplay(0, AXIS_FORMAT_TIME, "H");
//$myPicture->drawScale(array("DrawXLines"=>array(0)));
/* Draw the 1st stock chart */
$mystockChart = new pStock($myPicture, $MyData);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 30));
$mystockChart->drawStockChart();
/* Reset the display mode because of the graph small size */
//$MyData->setAxisDisplay(0,AXIS_FORMAT_DEFAULT);
/* Draw the 2nd scale */
//$myPicture->setShadow(FALSE);
//$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));
/* Draw the 2nd stock chart */
//$mystockChart = new pStock($myPicture,$MyData);
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>30));
//$mystockChart->drawStockChart();
/* Render the picture (choose the best way) */
//$myPicture->autoOutput("pictures/example.drawStockChart.png");
$myPicture->render($imagefilename);
$current_time = time();
$graphgendate = $current_time;
return $graphgendate;
}
示例13: pImage
<?php
/* CAT:Surface chart*/
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
include "../class/pSurface.class.php";
/* Create the pChart object */
$myPicture = new pImage(400, 400);
/* Create a solid background */
$Settings = array("R" => 179, "G" => 217, "B" => 91, "Dash" => 1, "DashR" => 199, "DashG" => 237, "DashB" => 111);
$myPicture->drawFilledRectangle(0, 0, 400, 400, $Settings);
/* Do a gradient overlay */
$Settings = array("StartR" => 194, "StartG" => 231, "StartB" => 44, "EndR" => 43, "EndG" => 107, "EndB" => 58, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 400, 400, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 400, 20, 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, 399, 399, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "pSurface() :: 2D surface charts", array("R" => 255, "G" => 255, "B" => 255));
/* Define the charting area */
$myPicture->setGraphArea(20, 40, 380, 380);
$myPicture->drawFilledRectangle(20, 40, 380, 380, array("R" => 255, "G" => 255, "B" => 255, "Surrounding" => -200, "Alpha" => 20));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1));
/* Create the surface object */
$mySurface = new pSurface($myPicture);
/* Set the grid size */
$mySurface->setGrid(20, 20);
/* Write the axis labels */
示例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();
示例15: pImage
<?php
/* 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, "setShadow() - Add shadows", array("R" => 255, "G" => 255, "B" => 255));
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw a filled circle */
$formSettings = array("R" => 201, "G" => 230, "B" => 40, "Alpha" => 100, "Surrounding" => 30);
$myPicture->drawFilledCircle(90, 120, 30, $formSettings);
/* Draw a filled rectangle */
$formSettings = array("R" => 231, "G" => 197, "B" => 40, "Alpha" => 100, "Surrounding" => 30);
$myPicture->drawFilledRectangle(160, 90, 280, 150, $formSettings);
/* Draw a filled rounded rectangle */
$formSettings = array("R" => 231, "G" => 102, "B" => 40, "Alpha" => 100, "Surrounding" => 70);
$myPicture->drawRoundedFilledRectangle(320, 90, 440, 150, 5, $formSettings);