本文整理汇总了PHP中pImage::render方法的典型用法代码示例。如果您正苦于以下问题:PHP pImage::render方法的具体用法?PHP pImage::render怎么用?PHP pImage::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pImage
的用法示例。
在下文中一共展示了pImage::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayCommandLine
/**
* Main display method for command line interface
*/
protected function displayCommandLine()
{
$this->completeChart();
if (count($this->request_remainder) > 0) {
$output_file = array_shift($this->request_remainder);
} else {
$output_file = "pChart.out.png";
}
$this->chartImage->render($output_file);
}
示例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: displayGraph
//.........这里部分代码省略.........
$mydatat[$name] = array();
}
array_push($mydatat[$name], $value);
}
}
$ret = $pmServiceevent->getRef($rrdtool_template);
$a_ref = $ret[0];
break;
case '1y':
$begin = date('Y-m-d H:i:s', date('U') - 365 * 24 * 3600);
$query = "SELECT * FROM `" . $this->getTable() . "`\n WHERE `plugin_monitoring_services_id`='" . $items_id . "'\n AND `type`='10d'\n ORDER BY `date`";
$result = $DB->query($query);
while ($edata = $DB->fetch_array($result)) {
$dat = importArrayFromDB($edata['data']);
if (count($dat) > 0) {
$datemod = $edata['date'];
$daynum = date('m', PluginMonitoringServiceevent::convert_datetime_timestamp($edata['date']));
$daynum = $daynum - 1;
$split = explode(' ', $datemod);
$day = explode("-", $split[0]);
array_push($a_labels, $LANG['calendarM'][$daynum] . " " . $day[2]);
}
foreach ($dat as $name => $value) {
if (!isset($mydatat[$name])) {
$mydatat[$name] = array();
}
array_push($mydatat[$name], $value);
}
}
$ret = $pmServiceevent->getRef($rrdtool_template);
$a_ref = $ret[0];
break;
}
$i = 0;
foreach ($mydatat as $name => $data) {
$i++;
if ($i == '2') {
$datat = $data;
$data = array();
foreach ($datat as $val) {
array_push($data, -$val);
}
}
if (empty($data)) {
array_push($data, 0);
}
$MyData->addPoints($data, $name);
$color = str_split($a_ref[$name]);
$MyData->setPalette($name, array("R" => hexdec($color[0] . $color[1]), "G" => hexdec($color[2] . $color[3]), "B" => hexdec($color[4] . $color[5])));
}
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC, 1);
// $MyData->setSerieTicks("Probe 2",4);
// $MyData->setAxisName(0,"Temperatures");
$MyData->addPoints($a_labels, "Labels");
// $MyData->setSerieDescription("Labels","Months");
$MyData->setAbscissa("Labels");
$myPicture = new pImage(700, 230, $MyData);
$myPicture->Antialias = FALSE;
$Settings = array("R" => 225, "G" => 204, "B" => 123);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
$Settings = array("R" => 255, "G" => 255, "B" => 255);
$myPicture->drawFilledRectangle(60, 40, 650, 200, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../lib/pChart2.1.3/fonts/verdana.ttf", "FontSize" => 11));
$myPicture->drawText(350, 20, $a_jsong->data[0]->labels[0]->title, array("FontSize" => 13, "Align" => TEXT_ALIGN_MIDDLEMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../lib/pChart2.1.3/fonts/verdana.ttf", "FontSize" => 7));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$labelskip = round(count($a_labels) / 8);
if ($time == '1d') {
$labelskip = 3;
} else {
if ($time == '1m') {
$labelskip = 3;
} else {
if ($time == '0y6m') {
$labelskip = 4;
} else {
if ($time == '1y') {
$labelskip = 3;
}
}
}
}
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 158, "GridG" => 158, "GridB" => 158, "GridAlpha" => 80, "DrawSubTicks" => TRUE, "CycleBackground" => FALSE, "LabelSkip" => $labelskip);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend(540, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
$Config = array("ForceTransparency" => 60);
/* Draw the area chart */
$myPicture->drawAreaChart($Config);
$myPicture->render(GLPI_PLUGIN_DOC_DIR . "/monitoring/" . $itemtype . "-" . $items_id . "-" . $time . $timezonefile . ".png");
return;
}
示例4: drawPieChart
/**
* Desenha um gráfico de torta
* @param $title título do graico
* @param $data vetor contendo os dados do gráfico
* @param $width largura do gráfico
* @param $height altura do gráfico
* @param $outputPath caminho de saída do gráfico
*/
public function drawPieChart($title, $data, $width, $height, $outputPath)
{
// cria o modelo de dados
$modelo = new pData();
$newdata = array();
foreach ($data as $legend => $value) {
$newdata[] = $value == NULL ? VOID : $value;
$labels[] = $legend;
}
$modelo->addPoints($newdata, "ScoreA");
/* Define the absissa serie */
$modelo->addPoints($labels, "Labels");
$modelo->setAbscissa("Labels");
// cria o objeto que irá conter a imagem do gráfico
$imagem = new pImage($width, $height, $modelo);
// adiciona uma borda na forma de um retângulo dentro da imagem
$imagem->drawRectangle(0, 0, $width - 1, $height - 1, array("R" => 0, "G" => 0, "B" => 0));
// escreve um título dentro do gráfico
$imagem->setFontProperties(array("FontName" => "app/lib/pchart/fonts/Forgotte.ttf", "FontSize" => 11));
$imagem->drawText(60, 35, $title, array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMLEFT));
// define a fonte dos dados do gráfico
$imagem->setFontProperties(array("FontName" => "app/lib/pchart/fonts/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
// cria o gráfico de torta
$pie = new pPie($imagem, $modelo);
// desenha o gráfico de torta
$pie->draw3DPie($width / 2, $height / 2, array('WriteValues' => TRUE, 'DrawLabels' => TRUE, "Radius" => $width / 4, 'ValueR' => 0, 'ValueG' => 0, 'ValueB' => 0, 'ValueAlpha' => 80));
// desenha a legenda do gráfico
$imagem->setShadow(FALSE);
$pie->drawPieLegend(15, 40, array("Alpha" => 20));
// grava o gráfico em um arquivo
$imagem->render($outputPath);
}
示例5: array
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "GridAlpha" => 100, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
//$myPicture->drawLegend(640,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Enable shadow computing */
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Draw the area chart */
//$Threshold = "";
// $Threshold[] = array("Min"=>0,"Max"=>5,"R"=>187,"G"=>220,"B"=>0,"Alpha"=>100);
//$Threshold[] = array("Min"=>5,"Max"=>10,"R"=>240,"G"=>132,"B"=>20,"Alpha"=>100);
// $Threshold[] = array("Min"=>10,"Max"=>20,"R"=>240,"G"=>91,"B"=>20,"Alpha"=>100);
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
//$myPicture->drawAreaChart(array("Threshold"=>$Threshold));
/* Draw a line chart over */
$myPicture->drawLineChart(array("ForceColor" => TRUE, "ForceR" => 0, "ForceG" => 0, "ForceB" => 0));
/* Draw a plot chart over */
//$myPicture->drawPlotChart(array("PlotBorder"=>TRUE,"BorderSize"=>1,"Surrounding"=>-255,"BorderAlpha"=>80));
/* Write the thresholds */
$myPicture->drawThreshold(3000, array("WriteCaption" => FALSE, "Caption" => "tiefentladen", "Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
$myPicture->drawThreshold(4250, array("WriteCaption" => FALSE, "Caption" => "tiefentladen", "Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
//$myPicture->drawThreshold(10,array("WriteCaption"=>TRUE,"Caption"=>"Error Zone","Alpha"=>70,"Ticks"=>2,"R"=>0,"G"=>0,"B"=>255));
/* Render the picture (choose the best way) */
//imagejpeg ( $myPicture, "myPicture.jpg" , 100); //saves Image to Server
$myPicture->render("voltage.png");
// debug ==> picture debug... show image
// header('Content-Type: image/png');
// imagejpeg ( $myPicture);
//$myPicture->autoOutput("pictures/example.drawAreaChart.threshold.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: array
/* 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);
//$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);
$graphgendate = $current_time;
}
renderpage($title, $permalink, $altimage, $imagepath, $graphgendate, $message, false, $navigation);
示例8: 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;
}
示例9: eval_ccpc_genGraphLine
/**
* eval_ccpc_genGraphLine - Génère un graphique de type Line simple sous forme d'image au format PNG
*
* @category : eval_ccpc_functions
* @param array $data Données à partir desquelles le graphique est généré
* @return string URL de l'image générée
*
* @Author Ali Bellamine
*
* Structure de $data :<br>
* ['option'] => (array) Liste des labels disponibles<br>
* ['data'][nom de la catégorie][nom du label] => (int) Valeur du label<br>
* ['settings']['min'] => (int) Valeur (ordonnée) minimale<br>
* ['settings']['max'] => (int) Valeur (ordonnée) maximale<br>
* ['settings']['height'] => (int) Hauteur du graphique (en px)<br>
* ['settings']['width'] => (int) Largeur du graphique (en px)
*
*/
function eval_ccpc_genGraphLine($data)
{
// On vérifie les données fournit
if (isset($data) && isset($data['data']) && count($data['data']) > 0 && isset($data['option']) && count($data['option']) > 0) {
// On récupère le hash de $data
$hash = md5(json_encode($data));
// Chemin du fichier
$filePath = PLUGIN_PATH . 'cache/' . $hash . '.png';
$filePathURI = ROOT . 'evaluations/ccpc/cache/' . $hash . '.png';
// Si le hash existe déjà : on renvoie le lien de l'image // sinon en crée le graphique
if (is_file($filePath)) {
return $filePathURI;
} else {
// On crée l'image
/* On inclut la librairie */
require_once PLUGIN_PATH . 'core/pChart2.1.4/class/pData.class.php';
require_once PLUGIN_PATH . 'core/pChart2.1.4/class/pDraw.class.php';
require_once PLUGIN_PATH . 'core/pChart2.1.4/class/pImage.class.php';
/* On crée l'objet pData */
// Préparation des données
$tempDataArray = array();
// Contient les données chiffrés
foreach ($data['data'] as $tempDataLegend => $tempDataValue) {
if (is_array($tempDataValue)) {
foreach ($data['option'] as $key) {
if (isset($tempDataValue[$key]) && is_numeric($tempDataValue[$key])) {
$tempDataArray[$tempDataLegend][$key] = $tempDataValue[$key];
} else {
$tempDataArray[$tempDataLegend][$key] = VOID;
}
}
} else {
return FALSE;
}
}
$MyData = new pData();
foreach ($tempDataArray as $key => $value) {
$MyData->addPoints($value, $key);
}
$MyData->addPoints($data['option'], 'Label');
$MyData->setAbscissa("Label");
$MyData->setSerieDescription("Label", "Label");
/* On crée l'objet pChart */
if (isset($data['settings']['width'])) {
$width = $data['settings']['width'];
} else {
$width = 600;
}
if (isset($data['settings']['height'])) {
$height = $data['settings']['height'];
} else {
$height = 300;
}
$myPicture = new pImage($width, $height, $MyData, TRUE);
$myPicture->setFontProperties(array("FontName" => PLUGIN_PATH . "core/pChart2.1.4/fonts/MankSans.ttf", "FontSize" => 14, "R" => 80, "G" => 80, "B" => 80));
// On détermine les limites
$myPicture->setGraphArea(0, 0, $width, $height - 30);
$scaleSettings = array("DrawSubTicks" => TRUE);
if (isset($data['settings']['min']) && is_numeric($data['settings']['min']) && isset($data['settings']['max']) && is_numeric($data['settings']['max']) && $data['settings']['min'] < $data['settings']['max']) {
// Prise en charge de la possibilité d'imposer le min et le max
$scaleSettings['Mode'] = SCALE_MODE_MANUAL;
$scaleSettings['ManualScale'][0] = array('Min' => $data['settings']['min'], 'Max' => $data['settings']['max']);
// Min et Max sur l'axe des ordonnées
}
$myPicture->drawScale($scaleSettings);
$myPicture->drawLegend(10, 10, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
$settings = array("Surrounding" => -30, "InnerSurrounding" => 30, "DisplayValues" => TRUE, "ORIENTATION_HORIZONTAL" => TRUE);
$myPicture->drawLineChart($settings);
$myPicture->render($filePath);
return $filePathURI;
}
} else {
return FALSE;
}
}
示例10: drawOverAllImage
private function drawOverAllImage($date)
{
$res1 = $this->dataForGraph($date, 0);
$res2 = $this->dataForGraph($date, 1);
$MyData = new pData();
$MyData->addPoints($res1['percents'], "Load in % for server 1");
$MyData->addPoints($res2['percents'], "Load in % for server 2");
$MyData->setAxisName(0, "Participants");
$MyData->addPoints($res1['times'], "Labels");
// $MyData->addPoints($res2['times'], "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(1200, 560, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = TRUE;
/* Add a border to the picture */
//$myPicture->drawRectangle(0,0,890,290,array("R"=>0,"G"=>0,"B"=>0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => CORE_REPOSITORY_REAL_PATH . "class/pChart/fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(200, 35, "All Servers Resource Usage (" . $date . ")", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => CORE_REPOSITORY_REAL_PATH . "class/pChart/fonts/pf_arma_five.ttf", "FontSize" => 8));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 1100, 500);
$AxisBoundaries = array(0 => array("Min" => 0, "Max" => 100));
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE, "LabelSkip" => 1, 'Mode' => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries);
$myPicture->drawScale($scaleSettings);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the stacked area chart */
$myPicture->drawStackedAreaChart(array("DrawLine" => TRUE, "LineSurrounding" => -20));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line chart */
$myPicture->drawLineChart();
/* Write the chart legend */
$myPicture->drawLegend(800, 20, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* Render the picture (choose the best way) */
//$myPicture->autoOutput(App::$instance->opt->fizPath."class/pChart/pictures/example.drawLineChart.simple.png");
$myPicture->render(CORE_REPOSITORY_REAL_PATH . "class/pChart/pictures/load_at_" . $date . "_on_overall.png");
$path = CORE_REPOSITORY_HTTP_PATH . "class/pChart/pictures/load_at_" . $date . "_on_overall.png";
if (ST::isAjaxRequest()) {
$data = [];
print json_encode($data['path'] = $path);
} else {
return $path;
}
}
示例11: electrique_mois
function electrique_mois()
{
//initialisation des variables tableau
$timestamp = "";
$conso = "";
$sql = mysql_query("SELECT TIMESTAMP(CONCAT(YEAR(date_histo ),'-',MONTH(date_histo ),'-',DAY(date_histo ),' ',HOUR(date_histo ),':00')),\n\t\t\t\t\tdate_histo, AVG(valeur1),MAX(valeur1),MIN(valeur1)\n\t\t\t\t\tFROM historique_donnees\n\t\t\t\t\tWHERE id_objet = 2\n\t\t\t\t\tAND date_histo > DATE_SUB(NOW( ), INTERVAL 31 DAY)\n\t\t\t\t\tGROUP BY YEAR( date_histo ) , MONTH( date_histo ) , DAY( date_histo ), HOUR( date_histo ), id_objet\n\t\t\t\t\tHAVING HOUR( date_histo ) IN ( 00, 06, 12, 18 ) \n\t\t\t\t\tORDER BY date_histo");
while (list($date_histo, $date_histo2, $conso_sql, $conso_sql_max, $conso_sql_min) = mysql_fetch_array($sql)) {
$timestamp[] = strtotime($date_histo);
$conso[] = $conso_sql;
$conso_max[] = $conso_sql_max;
$conso_min[] = $conso_sql_min;
}
$myData = new pData();
$myData->addPoints($timestamp, "Timestamp");
$myData->addPoints($conso, "Consommation Instantanée Moyenne");
$myData->addPoints($conso_max, "Conso. Inst. Max");
$myData->addPoints($conso_min, "Conso. Inst. Min");
$myData->setSerieOnAxis("Consommation Instantanée", 0);
$myData->setSerieOnAxis("Conso. Inst. Max", 0);
$myData->setSerieOnAxis("Conso. Inst. Min", 0);
$myData->setAbscissa("Timestamp");
$myData->setXAxisName("Time");
$myData->setXAxisDisplay(AXIS_FORMAT_TIME, "d/m");
$myData->setAxisName(0, "Consommation Instantanée");
$myData->setAxisUnit(0, "W");
$myPicture = new pImage(1250, 550, $myData);
$Settings = array("StartR" => 48, "StartG" => 124, "StartB" => 183, "EndR" => 33, "EndG" => 86, "EndB" => 128, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 1250, 550, DIRECTION_VERTICAL, $Settings);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => "fonts/Forgotte.ttf", "FontSize" => 18));
$TextSettings = array("Align" => TEXT_ALIGN_MIDDLEMIDDLE, "R" => 255, "G" => 255, "B" => 255);
$myPicture->drawText(350, 25, "Consommation éléctrique", $TextSettings);
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(110, 50, 1160, 500);
$myPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => "fonts/Forgotte.ttf", "FontSize" => 14));
$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" => 45, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL, "LabelSkip" => 3);
$myPicture->drawScale($Settings);
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 10));
$Config = "";
$myPicture->drawSplineChart($Config);
$Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "fonts/Forgotte.ttf", "FontSize" => 14, "Margin" => 6, "Alpha" => 30, "BoxSize" => 5, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
$myPicture->drawLegend(563, 16, $Config);
$myPicture->render("tmp/graphe_em.png");
echo "<img src='tmp/graphe_em.png' alt='graphe'/>";
}
示例12: array
$myPicture->setFontProperties(array("FontName" => "../../../fonts/calibri.ttf", "FontSize" => 8));
$TextSettings = array("R" => 15, "G" => 15, "B" => 255, "Angle" => 0);
$Config = "";
if (dvb($chanel_id, $group_id) == true) {
if ($last <= 1000) {
$Settings = array("R" => 230, "G" => 56, "B" => 30);
} else {
$Settings = array("R" => 41, "G" => 183, "B" => 31);
}
$myPicture->drawFilledRectangle(0, 0, 100, 55, $Settings);
$myPicture->drawSplineChart($Config);
$myPicture->drawText(0, 20, "Sig:" . $last, $TextSettings);
} else {
if ($last <= 1000 or $onair == 0) {
$Settings = array("R" => 230, "G" => 56, "B" => 30);
} else {
$Settings = array("R" => 76, "G" => 224, "B" => 175);
}
$myPicture->drawFilledRectangle(0, 0, 100, 55, $Settings);
$myPicture->drawSplineChart($Config);
$myPicture->drawText(0, 20, "Bit:" . $last, $TextSettings);
}
$myPicture->drawText(0, 10, $name, $TextSettings);
$myPicture->drawText(0, 50, $ldt, $TextSettings);
$rnd = GetRandomId(10);
$myPicture->render("../../../files/tmp" . $chanel_id . $group_id . ".png");
echo "<img src='/files/tmp" . $chanel_id . $group_id . ".png?" . $rnd . "'> ";
}
echo "<div class='alert alert-success'><ul>";
echo "<button onclick='openMonurl({$astra_id})'>Обновить</button>";
echo "</ul></div>";
示例13: createStatistics
function createStatistics($graph, $limit, $lastUpdate, $language)
{
SpotTranslation::initialize($language);
$spotStatistics = new SpotStatistics($this->_db);
include_once "images/pchart/pData.class.php";
include_once "images/pchart/pDraw.class.php";
include_once "images/pchart/pImage.class.php";
$width = 800;
$height = 500;
$titleHeight = 20;
$dataSet = array();
$graphs = $this->getValidStatisticsGraphs();
$limits = $this->getValidStatisticsLimits();
switch ($graph) {
case 'spotsperhour':
$prepData = $this->prepareData($spotStatistics->getSpotCountPerHour($limit, $lastUpdate));
$legend = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
for ($x = 0; $x <= 23; $x++) {
$dataSet[] = @$prepData[$x];
}
$graphicType = "bar";
break;
case 'spotsperweekday':
$prepData = $this->prepareData($spotStatistics->getSpotCountPerWeekday($limit, $lastUpdate));
$legend = array(_("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday"), _("Sunday"));
$dataSet = array(@$prepData[1], @$prepData[2], @$prepData[3], @$prepData[4], @$prepData[5], @$prepData[6], @$prepData[0]);
$graphicType = "bar";
break;
case 'spotspermonth':
$prepData = $this->prepareData($spotStatistics->getSpotCountPerMonth($limit, $lastUpdate));
$legend = array(_("January"), _("February"), _("March"), _("April"), _("May"), _("June"), _("July"), _("August"), _("September"), _("October"), _("November"), _("December"));
for ($x = 1; $x <= 12; $x++) {
$dataSet[] = @$prepData[$x];
}
$graphicType = "bar";
break;
case 'spotspercategory':
$prepData = $this->prepareData($spotStatistics->getSpotCountPerCategory($limit, $lastUpdate));
$legend = array(_(SpotCategories::HeadCat2Desc(0)), _(SpotCategories::HeadCat2Desc(1)), _(SpotCategories::HeadCat2Desc(2)), _(SpotCategories::HeadCat2Desc(3)));
for ($x = 0; $x <= 3; $x++) {
$dataSet[] = @$prepData[$x];
}
$graphicType = "3Dpie";
break;
}
# switch
array_walk($dataSet, create_function('& $item, $key', 'if ($item === NULL) $item = 0;'));
$title = $graphs[$graph];
if (!empty($limit)) {
$title .= " (" . $limits[$limit] . ")";
}
# if
$imgData = new pData();
if ($graphicType == "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 ($graphicType == "3Dpie") {
include_once "images/pchart/pPie.class.php";
$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();
$data = $this->getImageInfoFromString($imageString);
return array('metadata' => $data['metadata'], 'content' => $imageString);
}
# img
}
示例14: array
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "GridAlpha" => 100, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
//$myPicture->drawLegend(640,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Enable shadow computing */
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Draw the area chart */
//$Threshold = "";
// $Threshold[] = array("Min"=>0,"Max"=>5,"R"=>187,"G"=>220,"B"=>0,"Alpha"=>100);
//$Threshold[] = array("Min"=>5,"Max"=>10,"R"=>240,"G"=>132,"B"=>20,"Alpha"=>100);
// $Threshold[] = array("Min"=>10,"Max"=>20,"R"=>240,"G"=>91,"B"=>20,"Alpha"=>100);
//$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
//$myPicture->drawAreaChart(array("Threshold"=>$Threshold));
/* Draw a line chart over */
$myPicture->drawLineChart(array("ForceColor" => TRUE, "ForceR" => 0, "ForceG" => 0, "ForceB" => 0));
/* Draw a plot chart over */
//$myPicture->drawPlotChart(array("PlotBorder"=>TRUE,"BorderSize"=>1,"Surrounding"=>-255,"BorderAlpha"=>80));
/* Write the thresholds */
$myPicture->drawThreshold(3000, array("WriteCaption" => FALSE, "Caption" => "max", "Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
$myPicture->drawThreshold(4250, array("WriteCaption" => FALSE, "Caption" => "min", "Alpha" => 70, "Ticks" => 2, "R" => 0, "G" => 0, "B" => 255));
//$myPicture->drawThreshold(10,array("WriteCaption"=>TRUE,"Caption"=>"Error Zone","Alpha"=>70,"Ticks"=>2,"R"=>0,"G"=>0,"B"=>255));
/* Render the picture (choose the best way) */
//imagejpeg ( $myPicture, "myPicture.jpg" , 100); //saves Image to Server
$voltagedatapng = $path . "/voltage.png";
$myPicture->render($voltagedatapng);
// debug ==> picture debug... show image
// header('Content-Type: image/png');
// imagejpeg ( $myPicture);
//$myPicture->autoOutput("pictures/example.drawAreaChart.threshold.png");
示例15: showTimeline
function showTimeline(CommonGLPI $ticket, $params = array())
{
global $CFG_GLPI;
/* Create and populate the pData object */
$MyData = new pData();
/* Create the pChart object */
$myPicture = new pImage(820, 29, $MyData);
/* Create the pIndicator object */
$Indicator = new pIndicator($myPicture);
$myPicture->setFontProperties(array("FontName" => GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the indicator sections */
$IndicatorSections = array();
$_groupsfinished = array();
$a_groups_list = array();
$IndicatorSections = PluginTimelineticketToolbox::getDetails($ticket, 'group');
foreach ($IndicatorSections as $groups_id => $data) {
$a_groups_list[$groups_id] = $groups_id;
$a_end = end($data);
if ($a_end['R'] == 235 && $a_end['G'] == 235 && $a_end['B'] == 235) {
$_groupsfinished[$groups_id] = true;
} else {
$_groupsfinished[$groups_id] = false;
}
}
echo "<tr>";
echo "<th colspan='2'>";
if (count($a_groups_list) > 1) {
_e('Groups in charge of the ticket', 'timelineticket');
} else {
_e('Group in charge of the ticket');
}
echo "</th>";
echo "</tr>";
$mylevels = array();
$restrict = getEntitiesRestrictRequest('', "glpi_plugin_timelineticket_grouplevels", '', '', true);
$restrict .= " ORDER BY rank";
$levels = getAllDatasFromTable("glpi_plugin_timelineticket_grouplevels", $restrict);
if (!empty($levels)) {
foreach ($levels as $level) {
if (!empty($level["groups"])) {
$groups = json_decode($level["groups"], true);
$mylevels[$level["name"]] = $groups;
}
}
}
$ticketlevels = array();
foreach ($IndicatorSections as $groups_id => $array) {
foreach ($mylevels as $name => $groups) {
if (in_array($groups_id, $groups)) {
$ticketlevels[$name][] = $groups_id;
}
}
}
//No levels
if (sizeof($ticketlevels) == 0) {
foreach ($IndicatorSections as $groups_id => $array) {
$ticketlevels[0][] = $groups_id;
}
}
ksort($ticketlevels);
foreach ($ticketlevels as $name => $groups) {
if (!isset($ticketlevels[0])) {
echo "<tr>";
echo "<th colspan='2'>";
echo $name;
echo "</th>";
echo "</tr>";
}
foreach ($IndicatorSections as $groups_id => $array) {
if (in_array($groups_id, $groups)) {
echo "<tr class='tab_bg_2'>";
echo "<td width='100'>";
echo Dropdown::getDropdownName("glpi_groups", $groups_id);
echo "</td>";
echo "<td>";
if ($ticket->fields['status'] != Ticket::CLOSED && $_groupsfinished[$groups_id] === false) {
$IndicatorSettings = array("Values" => array(100, 201), "CaptionPosition" => INDICATOR_CAPTION_BOTTOM, "CaptionLayout" => INDICATOR_CAPTION_DEFAULT, "CaptionR" => 0, "CaptionG" => 0, "CaptionB" => 0, "DrawLeftHead" => false, "DrawRightHead" => true, "ValueDisplay" => false, "IndicatorSections" => $array, "SectionsMargin" => 0);
$Indicator->draw(2, 2, 805, 25, $IndicatorSettings);
} else {
$IndicatorSettings = array("Values" => array(100, 201), "CaptionPosition" => INDICATOR_CAPTION_BOTTOM, "CaptionLayout" => INDICATOR_CAPTION_DEFAULT, "CaptionR" => 0, "CaptionG" => 0, "CaptionB" => 0, "DrawLeftHead" => false, "DrawRightHead" => false, "ValueDisplay" => false, "IndicatorSections" => $array, "SectionsMargin" => 0);
$Indicator->draw(2, 2, 814, 25, $IndicatorSettings);
}
$filename = $uid = Session::getLoginUserID(false) . "_testgroup" . $groups_id;
$myPicture->render(GLPI_GRAPH_DIR . "/" . $filename . ".png");
echo "<img src='" . $CFG_GLPI['root_doc'] . "/front/graph.send.php?file=" . $filename . ".png'><br/>";
echo "</td>";
echo "</tr>";
}
}
}
// Return list for unit tests
return $IndicatorSections;
}