本文整理汇总了PHP中pImage::setShadow方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::setShadow方法的具体用法?PHP pImage::setShadow怎么用?PHP pImage::setShadow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pImage
的用法示例。
在下文中一共展示了pImage::setShadow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例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;
}
示例3: index
function index()
{
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(getGenders($this->db), "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints(array("Female", "Male"), "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(240, 180, $MyData, TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => pClass . "fonts/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
/* Create the pPie object */
$PieChart = new pPie($myPicture, $MyData);
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw a splitted pie chart */
$PieChart->draw3DPie(120, 90, array("Radius" => 100, "DataGapAngle" => 12, "DataGapRadius" => 10, "Border" => TRUE));
/* Write the legend box */
$myPicture->setFontProperties(array("FontName" => pClass . "fonts/Silkscreen.ttf", "FontSize" => 6, "R" => 0, "G" => 0, "B" => 0));
$PieChart->drawPieLegend(140, 160, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
$myPicture->stroke();
//$myPicture->autoOutput("pictures/example.draw3DPie.transparent.png");
}
示例4: plot
function plot($lift)
{
$MyData = new pData();
$positivelift = array();
$negativelift = array();
foreach ($lift as $heading => $fpm) {
if ($fpm > 0) {
$positivelift[$heading] = $fpm;
$negativelift[$heading] = 0;
} else {
$negativelift[$heading] = -$fpm;
$positivelift[$heading] = 0;
}
}
$MyData->addPoints($positivelift, "ScoreA");
// green
$MyData->addPoints($negativelift, "ScoreB");
// red
$MyData->addPoints(array_keys($lift), "Coord");
$MyData->setAbscissa("Coord");
$myPicture = new pImage(700, 700, $MyData);
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$SplitChart = new pRadar();
$myPicture->setGraphArea(10, 10, 690, 690);
$Options = array("LabelPos" => RADAR_LABELS_HORIZONTAL, "BackgroundGradient" => array("StartR" => 255, "StartG" => 255, "StartB" => 255, "StartAlpha" => 50, "EndR" => 32, "EndG" => 109, "EndB" => 174, "EndAlpha" => 30), "DrawPoly" => TRUE, "PolyAlpha" => 50, "FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6);
$SplitChart->drawPolar($myPicture, $MyData, $Options);
$myPicture->autoOutput("lift.png");
}
示例5: 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");
}
示例6: 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);
}
示例7: GetGraphImageTag
function GetGraphImageTag($_data, $_texts, $_metric = true)
{
if (!StatisticProvider::$DrawChartImages || !function_exists("gd_info")) {
return "";
}
require_once LIVEZILLA_PATH . "_lib/trdp/pchart/class/pData.class.php";
require_once LIVEZILLA_PATH . "_lib/trdp/pchart/class/pDraw.class.php";
require_once LIVEZILLA_PATH . "_lib/trdp/pchart/class/pImage.class.php";
$MyData = new pData();
$dobject = array();
foreach ($_data as $obid => $values) {
foreach ($values as $key => $val) {
$values[$key] = round($val, 1);
}
$dv1[] = $values[0];
if (count($values) > 1) {
$dv2[] = $values[1];
}
if (count($values) > 2) {
$dv3[] = $values[2];
}
if (count($values) > 3) {
$dv4[] = $values[3];
}
$dobject[] = $obid;
if (count($dobject) == 5) {
break;
}
}
$MyData->addPoints($dv1, $_texts[1] . " ");
if (isset($dv2)) {
$MyData->addPoints($dv2, $_texts[2] . " ");
}
if (isset($dv3)) {
$MyData->addPoints($dv3, $_texts[3] . " ");
}
if (isset($dv4)) {
$MyData->addPoints($dv4, $_texts[4] . " ");
}
$MyData->setAxisName(0, $_texts[0]);
$MyData->setAxisDisplay(0, $_metric ? AXIS_FORMAT_METRIC : AXIS_FORMAT_RAW);
$MyData->addPoints($dobject, "Groups");
$MyData->setSerieDescription("Groups", "Group");
$MyData->setAbscissa("Groups");
$myPicture = new pImage(630, 210, $MyData);
$myPicture->Antialias = FALSE;
$myPicture->setFontProperties(array("FontName" => LIVEZILLA_PATH . "_lib/trdp/pchart/fonts/arimo.ttf", "FontSize" => 8, "R" => 120, "G" => 120, "B" => 120));
$myPicture->setGraphArea(46, 0, 620, 160);
$scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "YMargin" => 12, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
$myPicture->drawLegend(40, 190, array("Style" => LEGEND_BOX, "Mode" => LEGEND_HORIZONTAL, "BoxSize" => 4, "R" => 200, "G" => 200, "B" => 200, "Surrounding" => 20, "Alpha" => 30));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
$settings = array("Surrounding" => -30, "InnerSurrounding" => 30, "DisplayValues" => TRUE);
$myPicture->drawBarChart($settings);
$file = PATH_STATS . $this->Type . "/temp.png";
$myPicture->render($file);
return "<img src=\"data:image/png;base64," . IOStruct::ToBase64($file) . "\" />";
}
示例8: 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->loadPalette("../palettes/blind.color", TRUE);
$MyData->addPoints(array(150, 220, 300, 250, 420, 200, 300, 200, 110), "Server A");
$MyData->addPoints(array("January", "February", "March", "April", "May", "Juin", "July", "August", "September"), "Months");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Months");
/* Create the floating 0 data serie */
$MyData->addPoints(array(60, 80, 20, 40, 40, 50, 90, 30, 100), "Floating 0");
$MyData->setSerieDrawable("Floating 0", FALSE);
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 10, "R" => 110, "G" => 110, "B" => 110));
/* Write the title */
$myPicture->drawText(10, 13, "Net Income 2k8");
/* Set the graphical area */
$myPicture->setGraphArea(50, 30, 680, 180);
/* Draw the scale */
$AxisBoundaries = array(0 => array("Min" => 0, "Max" => 500));
$myPicture->drawScale(array("InnerTickWidth" => 0, "OuterTickWidth" => 0, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries, "LabelRotation" => 45, "DrawXLines" => FALSE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridTicks" => 0, "GridAlpha" => 30, "AxisAlpha" => 0));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$settings = array("Floating0Serie" => "Floating 0", "Surrounding" => 10);
$myPicture->drawBarChart($settings);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.drawBarChart.span.png");
示例9: 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");
}
示例10: list
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));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 14));
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255);
$myPicture->drawText($anchura / 2, 25, $title, $TextSettings);
$myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 10));
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 0, "G" => 0, "B" => 0);
$myPicture->drawText($anchura / 2, $altura - 20, "Evaluaciones", $TextSettings);
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(50, 50, $anchura - 25, $altura - 40);
$myPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => "fonts/pf_arma_five.ttf", "FontSize" => 6));
//$Settings = array("Pos"=>SCALE_POS_LEFTRIGHT
//, "Mode"=>SCALE_MODE_FLOATING
//, "LabelingMethod"=>LABELING_ALL
//, "GridR"=>255, "GridG"=>255, "GridB"=>255, "GridAlpha"=>50, "TickR"=>0, "TickG"=>0, "TickB"=>0, "TickAlpha"=>50, "LabelRotation"=>0, "CycleBackground"=>1, "DrawXLines"=>1, "DrawSubTicks"=>1, "SubTickR"=>255, "SubTickG"=>0, "SubTickB"=>0, "SubTickAlpha"=>50, "DrawYLines"=>ALL);
//$myPicture->drawScale($Settings);
$AxisBoundaries = array(0 => array("Min" => 0, "Max" => 10));
示例11: 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";
}
}
示例12: PlotPie
function PlotPie($rowA, $rowB, $name, $cch)
{
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pData.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pDraw.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pImage.class.php";
include $_SERVER['DOCUMENT_ROOT'] . "/TBSIM/Lib/class/pPie.class.php";
$MyData = new pData();
$MyData->addPoints($rowA, "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints($rowB, "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(700, 630, $MyData);
$myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 14));
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 252, "G" => 252, "B" => 252, "DrawBox" => 1, "BoxAlpha" => 30);
//$myPicture->drawText(350,25,$name,$TextSettings);
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(50, 50, 675, 690);
//$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,"FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6));
$Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_FLOATING, "LabelingMethod" => LABELING_ALL, "GridR" => 255, "GridG" => 255, "GridB" => 255, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "LabelRotation" => 0, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
//$myPicture->drawScale($Settings);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
/* Create the pPie object */
$PieChart = new pPie($myPicture, $MyData);
/* Draw an AA pie chart */
if ($cch == 11) {
$PieChart->draw2DPie(160, 140, array("DrawLabels" => TRUE, "LabelStacked" => TRUE, "Border" => TRUE));
}
if ($cch == 12) {
$PieChart->draw2DRing(160, 140, array("WriteValues" => TRUE, "ValueR" => 255, "ValueG" => 255, "ValueB" => 255, "Border" => TRUE));
}
if ($cch == 13) {
$PieChart->draw3DPie(160, 140, array("Radius" => 70, "DrawLabels" => TRUE, "LabelStacked" => TRUE, "Border" => TRUE));
}
/* Write the legend box */
$myPicture->setShadow(FALSE);
$PieChart->drawPieLegend(15, 40, array("Alpha" => 20));
/* Render the picture (choose the best way) */
$myPicture->autoOutput("pictures/example.draw2DPie.labels.png");
}
示例13: drawBarChart
private function drawBarChart($filename, $yAxisLabel, $dataSeries, $labelSeries)
{
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($dataSeries, "Members");
$MyData->setAxisName(0, "Members");
$MyData->addPoints($labelSeries, "Languages");
$MyData->setSerieDescription("Languages", "Languages");
$MyData->setAbscissa("Languages");
/* Create the pChart object */
$myPicture = new pImage(400, 250, $MyData, true);
//$myPicture->drawGradientArea(0,0,500,500,DIRECTION_VERTICAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>100));
//$myPicture->drawGradientArea(0,0,500,500,DIRECTION_HORIZONTAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>20));
$myPicture->setFontProperties(array("FontName" => "../lib/pchart-2.1.3/fonts/verdana.ttf", "FontSize" => 6));
/* Draw the chart scale */
$myPicture->setGraphArea(70, 20, 380, 200);
$myPicture->drawScale(array("CycleBackground" => TRUE, "LabelRotation" => 30, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Create the per bar palette */
$Palette = array("0" => array("R" => 188, "G" => 224, "B" => 46, "Alpha" => 100), "1" => array("R" => 224, "G" => 100, "B" => 46, "Alpha" => 100), "2" => array("R" => 224, "G" => 214, "B" => 46, "Alpha" => 100), "3" => array("R" => 46, "G" => 151, "B" => 224, "Alpha" => 100), "4" => array("R" => 176, "G" => 46, "B" => 224, "Alpha" => 100), "5" => array("R" => 224, "G" => 46, "B" => 117, "Alpha" => 100), "6" => array("R" => 92, "G" => 224, "B" => 46, "Alpha" => 100), "7" => array("R" => 224, "G" => 176, "B" => 46, "Alpha" => 100), "8" => array("R" => 120, "G" => 59, "B" => 19, "Alpha" => 100), "9" => array("R" => 10, "G" => 79, "B" => 39, "Alpha" => 100), "10" => array("R" => 100, "G" => 200, "B" => 59, "Alpha" => 100));
/* Draw the chart */
$myPicture->drawBarChart(array("DisplayPos" => LABEL_POS_OUTSIDE, "DisplayValues" => TRUE, "Surrounding" => 30, "OverrideColors" => $Palette));
/* Write the legend */
$myPicture->drawLegend(570, 215, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
$myPicture->render($filename . ".png");
}
示例14: 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();
}
示例15: 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");
}