Example #1
0
 protected function action_getImageMap()
 {
     ob_start();
     global $current_user;
     if (!isset($_REQUEST['imageMapId'])) {
         return;
     }
     require_once 'modules/AOR_Charts/lib/pChart/pChart.php';
     $img = new pImage(100, 100);
     $imageMapDir = create_cache_directory('modules/AOR_Charts/ImageMap/' . $current_user->id . '/');
     $id = $current_user->id . "-" . (int) $_REQUEST['imageMapId'];
     ob_clean();
     $img->dumpImageMap($id, IMAGE_MAP_STORAGE_FILE, $id, $imageMapDir);
 }
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(35, 28, 17, 27, 12, 12, 20, 15, 20, 28), "Open");
$MyData->addPoints(array(20, 17, 25, 20, 25, 23, 16, 29, 26, 17), "Close");
$MyData->addPoints(array(10, 11, 14, 11, 9, 4, 3, 7, 9, 5), "Min");
$MyData->addPoints(array(37, 32, 33, 29, 29, 25, 22, 34, 29, 31), "Max");
$MyData->addPoints(array(30, 20, 21, 24, 22, 18, 18, 24, 22, 24), "Median");
$MyData->setAxisDisplay(0, AXIS_FORMAT_CURRENCY, "\$");
$MyData->addPoints(array("Dec 13", "Dec 14", "Dec 15", "Dec 16", "Dec 17", "Dec 20", "Dec 21", "Dec 22", "Dec 23", "Dec 24"), "Time");
$MyData->setAbscissa("Time");
$MyData->setAbscissaName("Time");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMapStockChart", IMAGE_MAP_STORAGE_FILE, "StockChart", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapStockChart", IMAGE_MAP_STORAGE_FILE, "StockChart", "../tmp");
/* Turn of AAliasing */
$myPicture->Antialias = FALSE;
/* Draw the border */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 30, 650, 190);
/* Draw the scale */
$scaleSettings = array("GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Create the pStock object */
$mystockChart = new pStock($myPicture, $MyData);
Example #3
0
include CLASS_PATH . "/pImage.class.php";
include CLASS_PATH . "/pRadar.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(10, 20, 30, 40, 50, 60, 70, 80, 90), "ScoreA");
$MyData->addPoints(array(20, 40, 50, 12, 10, 30, 40, 50, 60), "ScoreB");
$MyData->setSerieDescription("ScoreA", "Coverage A");
$MyData->setSerieDescription("ScoreB", "Coverage B");
/* Define the absissa serie */
$MyData->addPoints(array(40, 80, 120, 160, 200, 240, 280, 320, 360), "Coord");
$MyData->setAbscissa("Coord");
/* Create the pChart object */
$myPicture = new pImage(300, 300, $MyData);
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMapPolarChart", IMAGE_MAP_STORAGE_FILE, "PolarChart", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapPolarChart", IMAGE_MAP_STORAGE_FILE, "PolarChart", "../tmp");
/* Draw the background */
$myPicture->drawGradientArea(0, 0, 300, 300, DIRECTION_VERTICAL, array("StartR" => 200, "StartG" => 200, "StartB" => 200, "EndR" => 240, "EndG" => 240, "EndB" => 240, "Alpha" => 100));
/* Add a border to the picture */
$RectangleSettings = array("R" => 180, "G" => 180, "B" => 180, "Alpha" => 100);
$myPicture->drawRectangle(0, 0, 299, 299, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 2, "Y" => 2, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Create the pRadar object */
$SplitChart = new pRadar();
/* Draw a radar chart */
<?php

/* Library settings */
define("CLASS_PATH", "../../../class");
define("FONT_PATH", "../../../fonts");
/* pChart library inclusions */
include CLASS_PATH . "/pDraw.class.php";
include CLASS_PATH . "/pImage.class.php";
/* Create the pChart object */
$myPicture = new pImage(700, 230);
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMap1", IMAGE_MAP_STORAGE_FILE, "Shapes", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMap1", IMAGE_MAP_STORAGE_FILE, "Shapes", "../tmp");
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* 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" => FONT_PATH . "/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawFilledRectangle() - Transparency & colors", array("R" => 255, "G" => 255, "B" => 255));
/* Turn on shadow computing */
include CLASS_PATH . "/pData.class.php";
include CLASS_PATH . "/pDraw.class.php";
include CLASS_PATH . "/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(150, 220, 300, 250, 420, 200, 300, 200, 100), "Server A");
$MyData->addPoints(array(140, VOID, 340, 300, 320, 300, 200, 100, 50), "Server B");
$MyData->setAxisName(0, "Hits");
$MyData->addPoints(array("January", "February", "March", "April", "May", "Juin", "July", "August", "September"), "Months");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Months");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMapBarChart", IMAGE_MAP_STORAGE_FILE, "BarChart.labels", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapBarChart", IMAGE_MAP_STORAGE_FILE, "BarChart.labels", "../tmp");
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* 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);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/pf_arma_five.ttf", "FontSize" => 6));
$myData->setAxisUnit(1, "°");
$myData->setAxisPosition(1, AXIS_POSITION_RIGHT);
/* Create the 1st scatter chart binding */
$myData->setScatterSerie("Probe 1", "Probe 3", 0);
$myData->setScatterSerieDescription(0, "This year");
$myData->setScatterSerieColor(0, array("R" => 0, "G" => 0, "B" => 0));
/* Create the 2nd scatter chart binding */
$myData->setScatterSerie("Probe 2", "Probe 3", 1);
$myData->setScatterSerieDescription(1, "Last Year");
/* Create the pChart object */
$myPicture = new pImage(400, 400, $myData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMapScatterPlotChart", IMAGE_MAP_STORAGE_FILE, "ScatterPlotChart", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapScatterPlotChart", IMAGE_MAP_STORAGE_FILE, "ScatterPlotChart", "../tmp");
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 400, 400, $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, 400, 400, DIRECTION_VERTICAL, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 399, 399, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/pf_arma_five.ttf", "FontSize" => 6));
/* Set the graph area */
$myPicture->setGraphArea(50, 30, 350, 330);
Example #7
0
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(-4, VOID, VOID, 12, 8, 3), "Probe 1");
$MyData->addPoints(array(3, 12, 15, 8, 5, -5), "Probe 2");
$MyData->addPoints(array(2, 7, 5, 18, 19, 22), "Probe 3");
$MyData->setSerieTicks("Probe 2", 4);
$MyData->setSerieWeight("Probe 3", 2);
$MyData->setAxisName(0, "Temperatures");
$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);
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMapLineChart", IMAGE_MAP_STORAGE_FILE, "LineChart", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapLineChart", IMAGE_MAP_STORAGE_FILE, "LineChart", "../tmp");
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* 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);
/* 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" => FONT_PATH . "/Forgotte.ttf", "FontSize" => 11));
include CLASS_PATH . "/pData.class.php";
include CLASS_PATH . "/pDraw.class.php";
include CLASS_PATH . "/pImage.class.php";
include CLASS_PATH . "/pPie.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(40, 60, 15, 10, 6, 4), "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints(array("<10", "10<>20", "20<>40", "40<>60", "60<>80", ">80"), "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(300, 260, $MyData);
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMap2DPieChart", IMAGE_MAP_STORAGE_FILE, "2DPieChart", "../pChart2.1.4/tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMap2DPieChart", IMAGE_MAP_STORAGE_FILE, "2DPieChart", "../pChart2.1.4/tmp");
/* Draw a solid background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 300, 300, $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, 300, 260, DIRECTION_VERTICAL, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 299, 259, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/Forgotte.ttf", "FontSize" => 10, "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));
Example #9
0
include CLASS_PATH . "/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(4, 2, 10, 12, 8, 3), "Probe 1");
$MyData->addPoints(array(3, 12, 15, 8, 5, 5), "Probe 2");
$MyData->addPoints(array(2, 7, 5, 18, 15, 22), "Probe 3");
$MyData->setSerieTicks("Probe 2", 4);
$MyData->setAxisName(0, "Temperatures");
$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);
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMapAreaChart", IMAGE_MAP_STORAGE_FILE, "AreaChart", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapAreaChart", IMAGE_MAP_STORAGE_FILE, "AreaChart", "../tmp");
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* 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);
/* 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" => FONT_PATH . "/Forgotte.ttf", "FontSize" => 11));
include CLASS_PATH . "/pData.class.php";
include CLASS_PATH . "/pDraw.class.php";
include CLASS_PATH . "/pImage.class.php";
include CLASS_PATH . "/pPie.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(40, 60, 15, 10, 6, 4), "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints(array("<10", "10<>20", "20<>40", "40<>60", "60<>80", ">80"), "Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(300, 260, $MyData);
/* Retrieve the image map */
if (isset($_GET["ImageMap"]) || isset($_POST["ImageMap"])) {
    $myPicture->dumpImageMap("ImageMap3DRingChart", IMAGE_MAP_STORAGE_FILE, "3DRingChart", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMap3DRingChart", IMAGE_MAP_STORAGE_FILE, "3DRingChart", "../tmp");
/* Draw a solid background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 300, 300, $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, 300, 260, DIRECTION_VERTICAL, $Settings);
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 299, 259, array("R" => 0, "G" => 0, "B" => 0));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => FONT_PATH . "/Forgotte.ttf", "FontSize" => 10, "R" => 80, "G" => 80, "B" => 80));
/* Create the pPie object */
$Settings = array("RecordImageMap" => TRUE);