本文整理汇总了PHP中pImage::drawGradientArea方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::drawGradientArea方法的具体用法?PHP pImage::drawGradientArea怎么用?PHP pImage::drawGradientArea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pImage
的用法示例。
在下文中一共展示了pImage::drawGradientArea方法的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: renderChart
function renderChart($chartType, $title, $prepData, $legend)
{
$width = 800;
$height = 500;
$titleHeight = 20;
/*
* Create a dataset we can use
*/
$dataSet = array_values($prepData);
$imgData = new pData();
if ($chartType == "bar") {
$imgData->addPoints($dataSet, "data");
$imgData->addPoints($legend, "legend");
$imgData->setAbscissa("legend");
$imgData->setPalette("data", array("R" => 0, "G" => 108, "B" => 171, "Alpha" => 100));
$img = new pImage($width, $height, $imgData);
$img->drawGradientArea(0, $titleHeight, $width, $height, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 18, "EndG" => 52, "EndB" => 86, "Alpha" => 100));
$img->drawGradientArea(0, 0, $width, $titleHeight, DIRECTION_VERTICAL, array("StartR" => 18, "StartG" => 52, "StartB" => 86, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
$img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Bold.ttf", "FontSize" => 10));
$img->drawText($width / 2, 13, $title, array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255));
$img->setFontProperties(array("R" => 255, "G" => 255, "B" => 255, "FontName" => "images/ttf/liberation-sans/LiberationSans-Regular.ttf", "FontSize" => 9));
$img->setGraphArea(60, $titleHeight + 20, $width - 50, $height - 30);
$img->drawScale(array("GridR" => 200, "GridG" => 200, "GridB" => 200, "Mode" => SCALE_MODE_START0));
$img->drawBarChart(array("Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Surrounding" => 10));
} elseif ($chartType == "3Dpie") {
$imgData->addPoints($dataSet, "data");
$imgData->addPoints($legend, "legend");
$imgData->setAbscissa("legend");
$img = new pImage($width, $height, $imgData, TRUE);
$PieChart = new pPie($img, $imgData);
$img->drawGradientArea(0, $titleHeight, $width, $height, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 18, "EndG" => 52, "EndB" => 86, "Alpha" => 100));
$img->drawGradientArea(0, 0, $width, $titleHeight, DIRECTION_VERTICAL, array("StartR" => 18, "StartG" => 52, "StartB" => 86, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 100));
$img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Bold.ttf", "FontSize" => 10));
$img->drawText($width / 2, 13, $title, array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255));
$PieChart->setSliceColor(0, array("R" => 0, "G" => 108, "B" => 171));
$PieChart->setSliceColor(1, array("R" => 205, "G" => 159, "B" => 0));
$PieChart->setSliceColor(2, array("R" => 0, "G" => 171, "B" => 0));
$PieChart->setSliceColor(3, array("R" => 171, "G" => 28, "B" => 0));
$img->setFontProperties(array("FontName" => "images/ttf/liberation-sans/LiberationSans-Regular.ttf", "FontSize" => 9));
$PieChart->draw3DPie($width / 2, $height / 2 + $titleHeight, array("Radius" => $width / 2 - 100, "SecondPass" => TRUE, "DrawLabels" => TRUE, "WriteValues" => TRUE, "Precision" => 2, "ValueR" => 0, "ValueG" => 0, "ValueB" => 0, "ValueAlpha" => 100, "SkewFactor" => 0.6, "LabelR" => 255, "LabelG" => 255, "LabelB" => 255, "LabelAlpha" => 100));
}
# if
if (isset($img)) {
ob_start();
$img->render(NULL);
$imageString = ob_get_clean();
$dimensions = $this->_svcImageUtil->getImageDimensions($imageString);
return array('metadata' => $dimensions, 'content' => $imageString);
} else {
return false;
}
# else
}
示例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();
}
示例4: 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");
}
示例5: array
function func_bargraphGenerate($student_id, $time, $type, $basepath, $success, $r = "", $g = "", $b = "", $name)
{
$bookIdResult = $this->func_getBookId('1,2');
$bookID = array();
foreach ($bookIdResult as $book) {
$bookID[] = $book['book_id'];
}
$getActivityTypeIdResult = $this->func_getActivityTypeId('WORD HUNT');
foreach ($getActivityTypeIdResult as $activityTypeId) {
$activityTypeId = $activityTypeId['activity_type_id'];
}
$getActivityIdResult = $this->func_getActivityId($bookID, $activityTypeId);
$actId = array();
foreach ($getActivityIdResult as $activityId) {
$actId[] = $activityId['activity_id'];
}
$actNewId = implode(',', $actId);
$k = 0;
$j = 0;
for ($i = 0; $i < 5; $i = $i + 1) {
$date[$k] = date("Y-m-d", strtotime("-{$i} day"));
$dateRec[] = date('M d', strtotime("-{$i} day"));
$k = $k + 1;
}
$successaccessmentResult = $this->fun_getAssmentResult($student_id, $actNewId, '', $date, "word_hunt", $success);
$totalaccessmentResult = $this->fun_getAssmentResult($student_id, $actNewId, '', $date, "word_hunt", '0,1');
for ($i = 0; $i < 5; $i = $i + 1) {
$j = $i;
if ($totalaccessmentResult['0']['count_' . $j] == "0") {
$totalaccessmentResult['0']['count_' . $j] = 1;
}
$per[$i] = $successaccessmentResult['0']['count_' . $j] / $totalaccessmentResult['0']['count_' . $j] * 100;
}
$MyData = new pData();
$MyData->addPoints($per, "Server A");
$MyData->setAxisName(0, "Percentage");
$MyData->addPoints(array_reverse($dateRec), "Months");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Months");
$myPicture = new pImage(350, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Add a border to the picture */
$myPicture->drawGradientArea(0, 0, 400, 230, DIRECTION_VERTICAL, array("StartR" => 255, "StartG" => 255, "StartB" => 255, "EndR" => 255, "EndG" => 255, "EndB" => 255, "Alpha" => 100));
// $myPicture->drawRectangle(0,0,400,229,array("R"=>0,"G"=>0,"B"=>0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => $basepath . "Silkscreen.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 350, 200);
/* Draw the scale */
$scaleSettings = array("GridR" => 300, "GridG" => 300, "GridB" => 200, "DrawSubTicks" => FALSE, "CycleBackground" => FALSE, "Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_MANUAL, "LabelingMethod" => LABELING_ALL);
$myPicture->drawScale($scaleSettings);
/* 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, "Mode" => 0);
$myPicture->drawBarChart($settings, $r, $g, $b);
/* Render the picture (choose the best way) */
$picname = $student_id . '_' . $name . '_' . $time . '.png';
$this->fun_getImageLog($student_id, $picname, $type, $time, $name);
$myPicture->render("uploads/graph/" . $picname);
}
示例6: 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, "drawGradientArea() - Transparency & colors", array("R" => 255, "G" => 255, "B" => 255));
/* Draw a gradient area */
$GradientSettings = array("StartR" => 181, "StartG" => 209, "StartB" => 27, "Alpha" => 100, "Levels" => -50);
$myPicture->drawGradientArea(20, 60, 400, 170, DIRECTION_HORIZONTAL, $GradientSettings);
/* Draw a gradient area */
$GradientSettings = array("StartR" => 209, "StartG" => 134, "StartB" => 27, "Alpha" => 30, "Levels" => -50);
$myPicture->drawGradientArea(30, 30, 200, 200, DIRECTION_VERTICAL, $GradientSettings);
/* Draw a gradient area */
$GradientSettings = array("StartR" => 209, "StartG" => 31, "StartB" => 27, "Alpha" => 100, "Levels" => 50);
$myPicture->drawGradientArea(480, 50, 650, 80, DIRECTION_HORIZONTAL, $GradientSettings);
/* Draw a gradient area */
$GradientSettings = array("StartR" => 209, "StartG" => 125, "StartB" => 27, "Alpha" => 100, "Levels" => 50);
示例7: pImage
/* Create the scatter chart binding */
$myData->setScatterSerie("X1", "Y1", 0);
$myData->setScatterSerie("X2", "Y2", 1);
$myData->setScatterSerie("X3", "Y3", 2);
$myData->setScatterSerie("X4", "Y4", 3);
$myData->setScatterSerieDrawable(1, FALSE);
$myData->setScatterSerieDrawable(2, FALSE);
$myData->setScatterSerieDrawable(3, FALSE);
/* Create the pChart object */
$myPicture = new pImage(800, 582, $myData);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 800, 582, $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, 800, 582, DIRECTION_VERTICAL, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 799, 581, array("R" => 0, "G" => 0, "B" => 0));
/* Write the title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 23));
$myPicture->drawText(55, 50, "Anscombe's Quartet drawing example", array("R" => 255, "G" => 255, "B" => 255));
$myPicture->drawText(55, 65, "This example demonstrate the importance of graphing data before analysing it. (The line of best fit is the same for all datasets)", array("FontSize" => 12, "R" => 255, "G" => 255, "B" => 255));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Create the Scatter chart object */
$myScatter = new pScatter($myPicture, $myData);
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the 1st chart */
$myPicture->setGraphArea(56, 90, 380, 285);
$myScatter->drawScatterScale(array("XMargin" => 5, "YMargin" => 5, "Floating" => TRUE, "DrawSubTicks" => TRUE));
示例8: pData
/* CAT:Stacked chart */
/* pChart library inclusions */
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(4, VOID, VOID, 12, 8, 3), "Frontend #1");
$MyData->addPoints(array(3, 12, 15, 8, 5, 5), "Frontend #2");
$MyData->addPoints(array(2, 7, 5, 18, 19, 22), "Frontend #3");
$MyData->setAxisName(0, "Average Usage");
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale and the chart */
$myPicture->setGraphArea(60, 20, 680, 190);
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL_START0));
$myPicture->setShadow(FALSE);
$myPicture->drawStackedBarChart(array("Surrounding" => -15, "InnerSurrounding" => 15));
/* Write a label */
$myPicture->writeLabel(array("Frontend #1", "Frontend #2", "Frontend #3"), 1, array("DrawVerticalLine" => TRUE));
/* Write the chart legend */
$myPicture->drawLegend(480, 210, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawStackedBarChart.shaded.png");
示例9: pData
}
}
$myData = new pData();
$myData->addPoints($average, "Serie1");
$myData->setSerieDescription("Serie1", "Average");
$myData->setSerieOnAxis("Serie1", 0);
$serieSettings = array("R" => 255, "G" => 250, "B" => 200);
$myData->setPalette("Serie1", $serieSettings);
$myData->addPoints($hour, "Absissa");
$myData->setAbscissa("Absissa");
$myData->setAxisPosition(0, AXIS_POSITION_LEFT);
$myData->setAxisName(0, "");
$myData->setAxisUnit(0, "");
$myPicture = new pImage(160, 65, $myData, TRUE);
$GradientSettings = array("StartR" => 050, "StartG" => 100, "StartB" => 150, "Alpha" => 50, "Levels" => -100);
$myPicture->drawGradientArea(0, 0, 160, 80, DIRECTION_VERTICAL, $GradientSettings);
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(14, 7, 153, 60);
$myPicture->setFontProperties(array("R" => 250, "G" => 250, "B" => 250, "FontName" => "../pchart/fonts/Forgotte.ttf", "FontSize" => 8));
$max = max($average) + 5;
if ($max <= 0) {
$max = 1;
}
if ($max > 64) {
$max = 64;
}
$min = min($average) - 5;
if ($min < 0) {
$min = 0;
}
$Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => array(0 => array("Min" => $min, "Max" => $max)), "LabelingMethod" => LABELING_ALL, "GridR" => 200, "GridG" => 200, "GridB" => 200, "GridAlpha" => 75, "TickR" => 240, "TickG" => 240, "TickB" => 240, "TickAlpha" => 75, "LabelRotation" => 0, "LabelSkip" => 1, "DrawXLines" => 0, "DrawSubTicks" => 1, "DrawYLines" => ALL, "SubTickR" => 210, "SubTickG" => 210, "SubTickB" => 210, "SubTickAlpha" => 75, "AxisR" => 210, "AxisG" => 210, "AxisB" => 210, "AxisAlpha" => 75);
示例10: array
$MyData->addPoints($tabNote, "ScoreB");
$MyData->setSerieDescription("ScoreA", "Moyenne classe");
$MyData->setSerieDescription("ScoreB", "Notes étudiant");
$MyData->setPalette("ScoreB", array("R" => 0, "G" => 0, "B" => 0, "Alpha" => 100));
$MyData->setPalette("ScoreA", array("R" => 224, "G" => 100, "B" => 46, "Alpha" => 100));
/* Create the X serie */
$MyData->addPoints($tabModule, "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(1000, 460, $MyData);
/* Draw a solid background */
$Settings = array("R" => 255, "G" => 255, "B" => 255, "Dash" => 1, "DashR" => 255, "DashG" => 255, "DashB" => 255);
$myPicture->drawFilledRectangle(0, 0, 1000, 460, $Settings);
/* Overlay some gradient areas */
$Settings = array("StartR" => 255, "StartG" => 255, "StartB" => 255, "EndR" => 240, "EndG" => 255, "EndB" => 247, "Alpha" => 90);
$myPicture->drawGradientArea(0, 0, 1000, 460, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 1000, 20, DIRECTION_VERTICAL, array("StartR" => 255, "StartG" => 99, "StartB" => 71, "EndR" => 124, "EndG" => 122, "EndB" => 122, "Alpha" => 100));
/* Draw the border */
$myPicture->drawRectangle(0, 0, 999, 459, array("R" => 255, "G" => 99, "B" => 71));
/* Write the title */
$myPicture->setFontProperties(array("FontName" => "pChart2.1.4/fonts/arial.ttf", "FontSize" => 18));
$myPicture->drawText(10, 18, $var2["shortname"] . " " . date('d-m-Y'), array("R" => 255, "G" => 255, "B" => 255));
/* Define general drawing parameters */
$myPicture->setFontProperties(array("FontName" => "pChart2.1.4/fonts/arial.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Create the radar object */
$SplitChart = new pRadar();
/* Draw the 1st radar chart */
$myPicture->setGraphArea(20, 25, 995, 425);
$Options = array("Layout" => RADAR_LAYOUT_STAR, "LabelPos" => RADAR_LABELS_HORIZONTAL, "BackgroundGradient" => array("StartR" => 255, "StartG" => 255, "StartB" => 255, "StartAlpha" => 100, "EndR" => 207, "EndG" => 227, "EndB" => 125, "EndAlpha" => 50));
$SplitChart->drawRadar($myPicture, $MyData, $Options);
示例11: pData
function generate_graph_image($outputfile)
{
// Create Graph Dataset and set axis attributes
$graphData = new pData();
$graphData->setAxisName(0, $this->ytitle_actual);
$graphData->addPoints($this->xlabels, "xaxis");
$graphData->setSerieDescription("xaxis", "xaxis");
$graphData->setAbscissa("xaxis");
$graphData->setXAxisName("ooo");
// Add each series of plot values to dataset, but Reportico will
// duplicate series were the same data are displayed in different forms
// so only add each unique series once
$seriesadded = array();
foreach ($this->plot as $k => $v) {
$series = $v["name"] . $k;
$graphData->addPoints($v["data"], $series);
$graphData->setSerieDescription($series, $v["legend"]);
}
/*
$graph->xgrid->SetColor($this->xgridcolor);
$graph->ygrid->SetColor($this->ygridcolor);
*/
/*
switch ( $this->xgriddisplay )
{
case "all":
$graph->xgrid->Show(true,true);
break;
case "major":
$graph->xgrid->Show(true,false);
break;
case "minor":
$graph->xgrid->Show(false,true);
break;
case "none":
default:
$graph->xgrid->Show(false,false);
break;
}
switch ( $this->ygriddisplay )
{
case "all":
$graph->ygrid->Show(true,true);
break;
case "major":
$graph->ygrid->Show(true,false);
break;
case "minor":
$graph->ygrid->Show(false,true);
break;
case "none":
default:
$graph->ygrid->Show(false,false);
break;
}
*/
/*
$graph->xaxis->SetFont($fontfamilies[$xaxisfont],$fontstyles[$xaxisfontstyle], $xaxisfontsize);
$graph->xaxis->SetColor($xaxiscolor,$xaxisfontcolor);
$graph->yaxis->SetFont($fontfamilies[$yaxisfont],$fontstyles[$yaxisfontstyle], $yaxisfontsize);
$graph->yaxis->SetColor($yaxiscolor,$yaxisfontcolor);
$graph->xaxis->title->SetFont($fontfamilies[$xtitlefont],$fontstyles[$xtitlefontstyle], $xtitlefontsize);
$graph->xaxis->title->SetColor($xtitlecolor);
$graph->yaxis->title->SetFont($fontfamilies[$ytitlefont],$fontstyles[$ytitlefontstyle], $ytitlefontsize);
$graph->yaxis->title->SetColor($ytitlecolor);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetLabelMargin(15);
$graph->yaxis->SetLabelMargin(15);
$graph->xaxis->SetTickLabels($xlabels);
$graph->xaxis->SetTextLabelInterval($xticklabint);
$graph->yaxis->SetTextLabelInterval($yticklabint);
$graph->xaxis->SetTextTickInterval($xtickinterval);
$graph->yaxis->SetTextTickInterval($ytickinterval);
*/
/*
if ( $gridpos == "front" )
$graph->SetGridDepth(DEPTH_FRONT);
*/
// Display the graph
/*?$graph->Stroke();*/
$this->apply_defaults_internal();
//echo "oo<BR>";
//echo "<PRE>";
//var_dump($graphData);
//echo $this->width."<BR>";
//echo $this->height_actual."<BR>";
$graphImage = new pImage($this->width_actual, $this->height_actual, $graphData);
/* Turn of Antialiasing */
$graphImage->Antialias = TRUE;
// Add gradient fill from chosen background color to white
$startgradient = $this->htmltorgb("#ffffff");
$color = $this->htmltorgb($this->graphcolor);
$graphImage->drawGradientArea(0, 0, $this->width_actual, $this->height_actual, DIRECTION_VERTICAL, array("StartR" => $startgradient[0], "StartG" => $startgradient[1], "StartB" => $startgradient[2], "EndR" => $color[0], "EndG" => $color[1], "EndB" => $color[2], "Alpha" => 100));
/* Add a border to the picture */
$graphImage->drawRectangle(0, 0, $this->width_actual - 1, $this->height_actual - 1, array("R" => 200, "G" => 200, "B" => 200));
/* Set the title font and draw it */
$graphImage->setFontProperties(array("FontName" => PCHARTFONTS_DIR . $this->titlefont, "FontSize" => $this->titlefontsize));
$this->titlecolor = $this->htmltorgb($this->titlecolor);
$graphImage->drawText(20, 30, $this->title_actual, array("R" => $this->titlecolor[0], "G" => $this->titlecolor[1], "B" => $this->titlecolor[2]));
//.........这里部分代码省略.........
示例12: tests_pchart3
public static function tests_pchart3()
{
/* @ 700x230 Filled spline chart drawing example. */
/* pChart library inclusions */
include 'lib/pChart/class/pData.class';
include 'lib/pChart/class/pDraw.class';
include 'lib/pChart/class/pImage.class';
/* Create and populate the pData object */
$MyData = new pData();
$MyData->setAxisName(0, "Strength");
for ($i = 0; $i <= 720; $i = $i + 20) {
$MyData->addPoints(cos(deg2rad($i)) * 100, "Probe 1");
$MyData->addPoints(cos(deg2rad($i + 90)) * 60, "Probe 2");
}
/* Create the pChart object */
$myPicture = new pImage(847, 304, $MyData);
$myPicture->drawGradientArea(0, 0, 847, 304, DIRECTION_VERTICAL, array("StartR" => 47, "StartG" => 47, "StartB" => 47, "EndR" => 17, "EndG" => 17, "EndB" => 17, "Alpha" => 100));
$myPicture->drawGradientArea(0, 250, 847, 304, DIRECTION_VERTICAL, array("StartR" => 47, "StartG" => 47, "StartB" => 47, "EndR" => 27, "EndG" => 27, "EndB" => 27, "Alpha" => 100));
$myPicture->drawLine(0, 249, 847, 249, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->drawLine(0, 250, 847, 250, array("R" => 70, "G" => 70, "B" => 70));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 846, 303, array("R" => 204, "G" => 204, "B" => 204));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => CINTIENT_INSTALL_DIR . "lib/pChart/fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawText(423, 14, "Cyclic magnetic field strength", array("R" => 255, "G" => 255, "B" => 255, "Align" => TEXT_ALIGN_MIDDLEMIDDLE));
/* Define the chart area */
$myPicture->setGraphArea(58, 27, 816, 228);
/* Draw a rectangle */
$myPicture->drawFilledRectangle(58, 27, 816, 228, array("R" => 0, "G" => 0, "B" => 0, "Dash" => TRUE, "DashR" => 0, "DashG" => 51, "DashB" => 51, "BorderR" => 0, "BorderG" => 0, "BorderB" => 0));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw the scale */
$myPicture->setFontProperties(array("R" => 255, "G" => 255, "B" => 255));
$ScaleSettings = array("XMargin" => 4, "DrawSubTicks" => TRUE, "GridR" => 255, "GridG" => 255, "GridB" => 255, "AxisR" => 255, "AxisG" => 255, "AxisB" => 255, "GridAlpha" => 30, "CycleBackground" => TRUE);
$myPicture->drawScale($ScaleSettings);
/* Draw the spline chart */
$myPicture->drawFilledSplineChart();
/* Write the chart boundaries */
$BoundsSettings = array("MaxDisplayR" => 237, "MaxDisplayG" => 23, "MaxDisplayB" => 48, "MinDisplayR" => 23, "MinDisplayG" => 144, "MinDisplayB" => 237);
$myPicture->writeBounds(BOUND_BOTH, $BoundsSettings);
/* Write the 0 line */
$myPicture->drawThreshold(0, array("WriteCaption" => TRUE));
/* Write the chart legend */
$myPicture->setFontProperties(array("R" => 255, "G" => 255, "B" => 255));
$myPicture->drawLegend(560, 266, array("Style" => LEGEND_NOBORDER));
/* Write the 1st data series statistics */
$Settings = array("R" => 188, "G" => 224, "B" => 46, "Align" => TEXT_ALIGN_BOTTOMLEFT);
$myPicture->drawText(620, 270, "Max : " . ceil($MyData->getMax("Probe 1")), $Settings);
$myPicture->drawText(680, 270, "Min : " . ceil($MyData->getMin("Probe 1")), $Settings);
$myPicture->drawText(740, 270, "Avg : " . ceil($MyData->getSerieAverage("Probe 1")), $Settings);
/* Write the 2nd data series statistics */
$Settings = array("R" => 224, "G" => 100, "B" => 46, "Align" => TEXT_ALIGN_BOTTOMLEFT);
$myPicture->drawText(620, 283, "Max : " . ceil($MyData->getMax("Probe 2")), $Settings);
$myPicture->drawText(680, 283, "Min : " . ceil($MyData->getMin("Probe 2")), $Settings);
$myPicture->drawText(740, 283, "Avg : " . ceil($MyData->getSerieAverage("Probe 2")), $Settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawFilledSplineChart.png");
}
示例13: render_graph
protected function render_graph($title, pData $MyData, $zoom, $width = 0, $height = 0)
{
// Check graph size sanity
$width = intval($width);
if ($width <= 50 || $width > 4096) {
$width = 700;
}
$height = intval($height);
if ($height <= 60 || $height > 4096) {
$height = 260;
}
$MyData->setSerieDescription("TimeStamp", "time");
$MyData->setAbscissa("TimeStamp");
switch ($zoom) {
case 'hour':
$MyData->setXAxisDisplay(AXIS_FORMAT_TIME, "H:00");
break;
case 'year':
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y");
break;
case 'month':
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y-m");
break;
case 'day':
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE, "Y-m-d");
break;
}
/* Create the pChart object */
$myPicture = new pImage($width, $height, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw a background */
$Settings = array("R" => 90, "G" => 90, "B" => 90, "Dash" => 1, "DashR" => 120, "DashG" => 120, "DashB" => 120);
$myPicture->drawFilledRectangle(0, 0, $width, $height, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, $width, $height, DIRECTION_HORIZONTAL, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => AmpConfig::get('prefix') . "/modules/pChart/fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, $title, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => AmpConfig::get('prefix') . "/modules/pChart/fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, $width - 20, $height - 50);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "RemoveSkippedAxis" => TRUE, "DrawSubTicks" => FALSE, "Mode" => SCALE_MODE_START0, "LabelRotation" => 45, "LabelingMethod" => LABELING_DIFFERENT);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line chart */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->drawLineChart();
/* Write a label over the chart */
$myPicture->writeLabel("Inbound", 720);
/* Write the chart legend */
$myPicture->drawLegend(280, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
header("Content-Disposition: filename=\"ampache-graph.png\"");
/* Render the picture (choose the best way) */
$myPicture->autoOutput();
}
示例14: pData
/* CAT:Bar Chart */
/* pChart library inclusions */
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(60, 30, 10), "Answers");
$MyData->setAxisName(0, "Answers (%)");
$MyData->addPoints(array("I do agree ", "I disagree ", "No opinion "), "Options");
$MyData->setAbscissa("Options");
/* Create the pChart object */
$myPicture = new pImage(500, 220, $MyData);
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 15));
$myPicture->drawText(20, 34, "Q: Flexibility is a key point of this library", array("FontSize" => 20));
/* Define the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Set the graph area */
$myPicture->setGraphArea(70, 60, 480, 200);
$myPicture->drawGradientArea(70, 60, 480, 200, DIRECTION_HORIZONTAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 255, "EndG" => 255, "EndB" => 255, "Alpha" => 30));
/* Draw the chart scale */
$scaleSettings = array("AxisAlpha" => 10, "TickAlpha" => 10, "DrawXLines" => FALSE, "Mode" => SCALE_MODE_START0, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Pos" => SCALE_POS_TOPBOTTOM);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->drawBarChart(array("DisplayValues" => TRUE, "DisplayShadow" => TRUE, "DisplayPos" => LABEL_POS_INSIDE, "Rounded" => TRUE, "Surrounding" => 30));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawBarChart.poll.png");
示例15: pImage
<?php
/* CAT:Misc */
/* pChart library inclusions */
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create the pChart object */
$myPicture = new pImage(550, 175);
/* Create a solid background */
$Settings = array("R" => 183, "G" => 161, "B" => 71, "Dash" => 1, "DashR" => 203, "DashG" => 181, "DashB" => 91);
$myPicture->drawFilledRectangle(0, 0, 550, 175, $Settings);
/* Do a gradient overlay */
$Settings = array("StartR" => 231, "StartG" => 228, "StartB" => 155, "EndR" => 138, "EndG" => 91, "EndB" => 10, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 550, 175, DIRECTION_VERTICAL, $Settings);
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/calibri.ttf", "FontSize" => 20));
/* Draw the text box */
$myPicture->setShadow(FALSE);
$myPicture->drawFilledRectangle(141, 77, 393, 126, array("Alpha" => 20, "R" => 230, "G" => 230, "B" => 230));
$myPicture->drawRectangle(141, 77, 393, 126, array("R" => 50, "G" => 50, "B" => 50));
/* Write the text */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
$TextSettings = array("R" => 201, "G" => 230, "B" => 40, "FontSize" => 40);
$myPicture->drawText(144, 125, "My text box", $TextSettings);
/* Prepare and draw the markers */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
$MyMarkerSettings = array("R" => 255, "G" => 0, "B" => 0, "BorderR" => 0, "BorderB" => 0, "BorderG" => 0, "Size" => 4);
$myPicture->drawRectangleMarker(141, 77, $MyMarkerSettings);
$myPicture->drawRectangleMarker(141, 101, $MyMarkerSettings);
$myPicture->drawRectangleMarker(141, 126, $MyMarkerSettings);
$myPicture->drawRectangleMarker(260, 77, $MyMarkerSettings);