/** * Render graph * *@return nothing **/ function render($p_stack = FALSE) { // declare the graph $Test = new pChart(800, 250); $Test->tmpFolder = $this->tmpPath; $fileId = time() . '_' . rand(1, 1000); $fontFile = "tahoma.ttf"; // prepare the map echo '<SCRIPT TYPE="text/javascript" SRC="' . $this->pChartPath . 'overlib.js"></SCRIPT> <SCRIPT TYPE="text/javascript" SRC="' . $this->pChartPath . 'pMap.js"></SCRIPT>'; $MapID = "map_" . $fileId . ".map"; $Test->setImageMap(TRUE, $MapID); $Map = new pChart(800, 250); $Map->tmpFolder = $this->tmpPath; $imgName = "img_" . $fileId . ".png"; $img = $this->tmpPath . $imgName; $imgLink = GLPI_ROOT . "/plugins/fusioninventory/front/send.php?file=" . urlencode("tmp/" . $imgName); $mapLink = GLPI_ROOT . "/plugins/fusioninventory/front/send.php?file=" . urlencode("tmp/" . $MapID); echo '<DIV ID="overDiv" STYLE="position:absolute; visibility:hidden; z-index:1000;"></DIV>'; echo "<IMG ID='fusioninventory_graph_{$fileId}' SRC='{$imgLink}' WIDTH=800 HEIGHT=250 BORDER=0 OnMouseMove='fusioninventory_graph(event);' OnMouseOut='nd();'>"; echo '<SCRIPT> function fusioninventory_graph(event) { LoadImageMap("fusioninventory_graph_' . $fileId . '","' . $mapLink . '"); getMousePosition(event); } </SCRIPT>'; // configure the graph $Test->setFontProperties($this->fontsPath . $fontFile, 8); $Test->setGraphArea(80, 30, 580, 185); // graph size : keep place for titles on X and Y axes $Test->drawFilledRoundedRectangle(7, 7, 793, 243, 5, 240, 240, 240); // background rectangle $Test->drawRoundedRectangle(5, 5, 795, 245, 5, 230, 230, 230); // 3D effect $Test->drawGraphArea(255, 255, 255, TRUE); $Test->setFixedScale(0, $this->getMaxY($this->maxValue), $this->divisionsY); // to see values from 0 $Test->drawScale($this->pData->GetData(), $this->pData->GetDataDescription(), SCALE_ADDALL, 150, 150, 150, TRUE, 0, 2, TRUE); $Test->drawGrid(4, TRUE, 230, 230, 230, 50); // Draw the 0 line $Test->setFontProperties($this->fontsPath . $fontFile, 6); // Draw the bar graph if ($p_stack) { $Test->drawStackedBarGraph($this->pData->GetData(), $this->pData->GetDataDescription(), 100); } else { $Test->drawBarGraph($this->pData->GetData(), $this->pData->GetDataDescription(), FALSE, 100); } // Finish the graph $Test->setFontProperties($this->fontsPath . $fontFile, 8); $Test->drawLegend(590, 30, $this->pData->GetDataDescription(), 255, 255, 255); // take care of legend text size $Test->setFontProperties($this->fontsPath . $fontFile, 10); $Test->drawTitle(50, 22, $this->title . ' (/ ' . $this->timeUnitName . ')', 50, 50, 50, 585); $Test->Render($img); }