Example #1
0
            $myPicture->drawGradientArea(0, 0, 700, $nbr_room * 30 + 30, 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, $nbr_room * 30 + 29, array("R" => 0, "G" => 0, "B" => 0));
            /* Write the picture title */
            $myPicture->setFontProperties(array("FontName" => "pChart/fonts/Silkscreen.ttf", "FontSize" => 6));
            $myPicture->drawText(10, 13, "Taux moyen de remplissage des baies", array("R" => 255, "G" => 255, "B" => 255));
            /* Set the font & shadow options */
            $myPicture->setFontProperties(array("FontName" => "pChart/fonts/verdana.ttf", "FontSize" => 10));
            $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
            $i = 30;
            foreach ($datas as $data) {
                $taux_moyen = $data['taux_moyen_remplissage'] * 100;
                /* Draw a progress bar */
                $progressOptions = array("Width" => 500, "R" => 134, "G" => 209, "B" => 27, "Surrounding" => 20, "BoxBorderR" => 0, "BoxBorderG" => 0, "BoxBorderB" => 0, "BoxBackR" => 255, "BoxBackG" => 255, "BoxBackB" => 255, "RFade" => 206, "GFade" => 133, "BFade" => 30, "ShowLabel" => TRUE, "LabelPos" => LABEL_POS_CENTER);
                $myPicture->drawProgress(160, $i, $taux_moyen, $progressOptions);
                $myPicture->drawText(50, $i + 13, $data['room_name'], array("R" => 255, "G" => 255, "B" => 255));
                $i = $i + 30;
            }
            if ($consult_date != "Donnée actuelle") {
                $myPicture->Render("images/tr_graph_render_{$consult_date}.png");
            } else {
                $myPicture->Render("images/tr_graph_render.png");
            }
        } else {
            $error = 1;
        }
    }
} catch (Exception $e) {
    // Catch des erreurs et écriture dans le fichier de log
    require 'error_log.php';
Example #2
0
<?php

/* CAT:Progress bars */
/* pChart library inclusions */
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
if (isset($_GET['percent'])) {
    $percent = $_GET['percent'];
} else {
    $percent = 0;
}
if (isset($_GET['size'])) {
    $getimagesize = explode('::', $_GET['size']);
    foreach ($getimagesize as $getimagesizepart) {
        $imagesizearray[] = $getimagesizepart;
    }
    $ImageSize = array($imagesizearray[0], $imagesizearray[1]);
} else {
    $ImageSize = array(115, 17);
}
/* Create the pChart object */
$myPicture = new pImage($ImageSize[0], $ImageSize[1]);
$myPicture->setFontProperties(array("FontName" => "../fonts/verdana.ttf", "FontSize" => 8, "R" => 255, "G" => 255, "B" => 255));
/* Draw a progress bar */
$progressOptions = array("Width" => $ImageSize[0] - 1, "Height" => $ImageSize[1] - 1, "R" => 121, "G" => 181, "B" => 68, "Surrounding" => 50, "BoxBorderR" => 204, "BoxBorderG" => 204, "BoxBorderB" => 204, "BoxBackR" => 200, "BoxBackG" => 200, "BoxBackB" => 200, "RFade" => 244, "GFade" => 120, "BFade" => 66, "ShowLabel" => TRUE, "LabelPos" => LABEL_POS_CENTER);
$myPicture->drawProgress(0, 0, $percent, $progressOptions);
/* Render the picture (choose the best way) */
$myPicture->autoOutput("zProgress.png");
$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, "drawProgress() - Simple progress bars", array("R" => 255, "G" => 255, "B" => 255));
/* Set the font & shadow options */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 10));
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 20));
/* Draw a progress bar */
$progressOptions = array("R" => 209, "G" => 31, "B" => 27, "Surrounding" => 20, "BoxBorderR" => 0, "BoxBorderG" => 0, "BoxBorderB" => 0, "BoxBackR" => 255, "BoxBackG" => 255, "BoxBackB" => 255, "RFade" => 206, "GFade" => 133, "BFade" => 30, "ShowLabel" => TRUE);
$myPicture->drawProgress(40, 60, 77, $progressOptions);
/* Draw a progress bar */
$progressOptions = array("Width" => 165, "R" => 209, "G" => 125, "B" => 27, "Surrounding" => 20, "BoxBorderR" => 0, "BoxBorderG" => 0, "BoxBorderB" => 0, "BoxBackR" => 255, "BoxBackG" => 255, "BoxBackB" => 255, "NoAngle" => TRUE, "ShowLabel" => TRUE, "LabelPos" => LABEL_POS_RIGHT);
$myPicture->drawProgress(40, 100, 50, $progressOptions);
/* Draw a progress bar */
$progressOptions = array("Width" => 165, "R" => 209, "G" => 198, "B" => 27, "Surrounding" => 20, "BoxBorderR" => 0, "BoxBorderG" => 0, "BoxBorderB" => 0, "BoxBackR" => 255, "BoxBackG" => 255, "BoxBackB" => 255, "ShowLabel" => TRUE, "LabelPos" => LABEL_POS_LEFT);
$myPicture->drawProgress(75, 140, 25, $progressOptions);
/* Draw a progress bar */
$progressOptions = array("Width" => 400, "R" => 134, "G" => 209, "B" => 27, "Surrounding" => 20, "BoxBorderR" => 0, "BoxBorderG" => 0, "BoxBorderB" => 0, "BoxBackR" => 255, "BoxBackG" => 255, "BoxBackB" => 255, "RFade" => 206, "GFade" => 133, "BFade" => 30, "ShowLabel" => TRUE, "LabelPos" => LABEL_POS_CENTER);
$myPicture->drawProgress(40, 180, 80, $progressOptions);
/* Draw a progress bar */
$progressOptions = array("Width" => 20, "Height" => 150, "R" => 209, "G" => 31, "B" => 27, "Surrounding" => 20, "BoxBorderR" => 0, "BoxBorderG" => 0, "BoxBorderB" => 0, "BoxBackR" => 255, "BoxBackG" => 255, "BoxBackB" => 255, "RFade" => 206, "GFade" => 133, "BFade" => 30, "ShowLabel" => TRUE, "Orientation" => ORIENTATION_VERTICAL, "LabelPos" => LABEL_POS_BOTTOM);
$myPicture->drawProgress(500, 200, 77, $progressOptions);
/* Draw a progress bar */
$progressOptions = array("Width" => 20, "Height" => 150, "R" => 209, "G" => 125, "B" => 27, "Surrounding" => 20, "BoxBorderR" => 0, "BoxBorderG" => 0, "BoxBorderB" => 0, "BoxBackR" => 255, "BoxBackG" => 255, "BoxBackB" => 255, "NoAngle" => TRUE, "ShowLabel" => TRUE, "Orientation" => ORIENTATION_VERTICAL, "LabelPos" => LABEL_POS_TOP);
$myPicture->drawProgress(540, 200, 50, $progressOptions);
Example #4
0
 /**
  * Frequency
  *
  * This uses the pChart library to graph the frequency.
  *
  * Upon browser request, this script will run with the specificed
  * percentage ($value) as a parameter. The pChart script will generate
  * a graph image on-the-fly which will then be displayed on the
  * variant page. As stated, they are on-the-fly images that are returned
  * at runtime and are not actually saved anywhere.
  *
  * The pChart library that can be found in application/third_party/pChart/
  * More info on pChart at http://www.pchart.net/
  *
  * @author Nikhil Anand
  * @author Sean Ephraim
  * @access public
  * @return void
  */
 public function frequency()
 {
     // this is needed to allow stroke() to modify headers
     ob_end_clean();
     // pChart Classes
     require_once APPPATH . "third_party/pChart/class/pDraw.class.php";
     require_once APPPATH . "third_party/pChart/class/pImage.class.php";
     // Validate precent value
     if (isset($_GET["value"]) && is_numeric($_GET["value"])) {
         $percent = trim($_GET["value"]);
     } else {
         print "Invalid value.\n";
         exit;
     }
     // Set default size
     $size = 200;
     if (isset($_GET["small"])) {
         $size = 60;
     }
     // Small bug with 0%
     if ($percent == 0) {
         $percent = 0.001;
     }
     /* Initialize object */
     $myPicture = new pImage($size, 12);
     $myPicture->setFontProperties(array("FontName" => APPPATH . "third_party/pChart/fonts/GeosansLight.ttf", "FontSize" => 15));
     /* Set options */
     $progressOptions = array("Width" => $size - 1, "Height" => 11, "R" => 8, "G" => 160, "B" => 43, "Surrounding" => 0, "BoxBorderR" => 204, "BoxBorderG" => 204, "BoxBorderB" => 204, "BoxBackR" => 255, "BoxBackG" => 255, "BoxBackB" => 255, "RFade" => 206, "GFade" => 133, "BFade" => 30, "ShowLabel" => FALSE);
     /* Draw a progress bar */
     $myPicture->drawProgress(0, 0, $percent, $progressOptions);
     $myPicture->stroke();
 }