/* pChart library inclusions */
include CLASS_PATH . "/pData.class.php";
include CLASS_PATH . "/pDraw.class.php";
include CLASS_PATH . "/pImage.class.php";
include CLASS_PATH . "/pStock.class.php";
/* 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);
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
for ($i = 0; $i <= 10; $i = $i + 0.2) {
    $MyData->addPoints(log($i + 1) * 10, "Bounds 1");
    $MyData->addPoints(log($i + 3) * 10 + rand(0, 2) - 1, "Probe 1");
    $MyData->addPoints(log($i + 6) * 10, "Bounds 2");
    $MyData->addPoints($i * 10, "Labels");
}
$MyData->setAxisName(0, "Size (cm)");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
$MyData->setAbscissaName("Time (years)");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Draw the background and the border  */
$myPicture->drawFilledRectangle(0, 0, 699, 229, array("R" => 200, "G" => 200, "B" => 200));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 220, "StartG" => 220, "StartB" => 220, "EndR" => 100, "EndG" => 100, "EndB" => 100, "Alpha" => 30));
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Size by time generations", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(40, 40, 680, 200);
예제 #3
0
/**
 * Helper method to draw bar graph
 * parameters have same meaning as displayGraph's parameters
 */
function displayBarGraph($fid, $frid, $labelElement, $dataElement, $operation, $graphOptions)
{
    // getting data from DB
    if (is_int($frid) && $frid > 0) {
        $dbData = getData($frid, $fid);
    } else {
        $dbData = getData("", $fid);
    }
    foreach ($dbData as $entry) {
        // mayor - OR array of mayors if there's more than one in the dataset, depending on the one-to-may in a relationship
        $dataRawValue = display($entry, $dataElement);
        // city_name;
        $labelRawValue = display($entry, $labelElement);
        if (!is_array($dataRawValue) && $dataRawValue) {
            $dataRawValue = array($dataRawValue);
        }
        if (!is_array($labelRawValue)) {
            $labelRawValue = array($labelRawValue);
        }
        foreach ($labelRawValue as $thisLabelValue) {
            if ($dataPoints[$thisLabelValue]) {
                $dataPoints[$thisLabelValue] = array_merge($dataPoints[$thisLabelValue], $dataRawValue);
            } else {
                $dataPoints[$thisLabelValue] = $dataRawValue;
            }
        }
    }
    // Oct 29 Update for column heading for graphs:
    $elementHandler = xoops_getmodulehandler('elements', 'formulize');
    $elementObject = $elementHandler->get($labelElement);
    $labelElement = $elementObject->getVar('ele_colhead') ? $elementObject->getVar('ele_colhead') : printSmart($elementObject->getVar('ele_caption'));
    $elementObject = $elementHandler->get($dataElement);
    $dataElement = $elementObject->getVar('ele_colhead') ? $elementObject->getVar('ele_colhead') : printSmart($elementObject->getVar('ele_caption'));
    // end of Update
    switch ($operation) {
        case "count":
            // count the values in each label of the array
            foreach (array_keys($dataPoints) as $key) {
                if (!empty($dataPoints[$key])) {
                    $dataPoints[$key] = count($dataPoints[$key]);
                } else {
                    $dataPoints[$key] = 0;
                }
            }
            if ($labelElement == $dataElement) {
                $dataElement = "count of " . $labelElement;
            } else {
                $dataElement = "count of " . $dataElement;
            }
            break;
        case "sum":
        case "display":
            // TODO: Check this!
            foreach ($dataPoints as $thisLabel => $theseValues) {
                $dataPoints[$thisLabel] = array_sum($theseValues);
            }
            $dataElement = ($operation == "display" ? "number of " : "sum of ") . $dataElement;
            break;
        case "count-unique":
            foreach ($dataPoints as $thisLabel => $theseValues) {
                $dataPoints[$thisLabel] = count(array_unique($theseValues));
            }
            if ($dataElement == $labelElement) {
                $dataElement = "count of unique " . $labelElement;
            } else {
                $dataElement = "count of unique " . $dataElement;
            }
            break;
        default:
            echo "Sorry, the operation \"{$operation}\" for Bar graph is not supported at the moment!";
            return;
    }
    // print("dataElement: ".$dataElement." ");
    // print("labelElement: ".$labelElement." ");
    // process the graph options
    // these defaults will be used, unless overwritten by values from the $graphOptions array
    $sizeMultiplier = sizeof(array_keys($dataPoints));
    $BAR_THICKNESS = 40;
    $IMAGE_WIDTH = 600;
    $IMAGE_DEFAULT_WIDTH = $IMAGE_WIDTH;
    if ($sizeMultiplier > 1) {
        $IMAGE_HEIGHT = $BAR_THICKNESS * $sizeMultiplier / 0.5;
    } else {
        $IMAGE_HEIGHT = $BAR_THICKNESS * 4;
    }
    $IMAGE_DEFAULT_HEIGHT = $IMAGE_HEIGHT;
    $IMAGE_ORIENTATION = "vertical";
    $BACKGROUND_R = 141;
    $BACKGROUND_G = 189;
    $BACKGROUND_B = 225;
    $BARCOLOR_R = 143;
    $BARCOLOR_G = 190;
    $BARCOLOR_B = 88;
    if (sizeof($graphOptions) > 0) {
        foreach ($graphOptions as $graphoption => $value) {
            switch ($graphoption) {
                case "width":
                    $IMAGE_WIDTH = $value;
                    break;
                case "height":
                    $IMAGE_HEIGHT = $value;
                    break;
                case "orientation":
                    $IMAGE_ORIENTATION = $value;
                    if ($IMAGE_ORIENTATION == "horizontal") {
                        if ($IMAGE_HEIGHT == $IMAGE_DEFAULT_HEIGHT) {
                            $IMAGE_HEIGHT = 500;
                        } else {
                            if ($IMAGE_WIDTH == $IMAGE_DEFAULT_WIDTH) {
                                $IMAGE_WIDTH = $BAR_THICKNESS * $sizeMultiplier / 0.5;
                            }
                        }
                    }
                    break;
                case "backgroundcolor":
                    // print_r($value);
                    foreach ($value as $RGB => $colorvalue) {
                        switch ($RGB) {
                            case "R":
                                $BACKGROUND_R = $colorvalue;
                                break;
                            case "G":
                                $BACKGROUND_G = $colorvalue;
                                break;
                            case "B":
                                $BACKGROUND_B = $colorvalue;
                                break;
                            default:
                                echo "Please follow the correct format of backgroundcolor.";
                                break;
                        }
                    }
                    break;
                case "barcolor":
                    // print_r($value);
                    foreach ($value as $RGB => $colorvalue) {
                        switch ($RGB) {
                            case "R":
                                $BARCOLOR_R = $colorvalue;
                                break;
                            case "G":
                                $BARCOLOR_G = $colorvalue;
                                break;
                            case "B":
                                $BARCOLOR_B = $colorvalue;
                                break;
                            default:
                                echo "Please follow the correct format of backgroundcolor.";
                                break;
                        }
                    }
                    break;
                default:
                    echo "Sorry, the graph option \"{$graphoption}\" for Bar graph is not supported at the moment!<br>";
                    break;
            }
        }
    }
    // reset width/height of the image in case the label is too long
    if (strlen($labelElement) * 4.5 >= $IMAGE_HEIGHT and $IMAGE_ORIENTATION == "vertical") {
        if ($IMAGE_HEIGHT == $IMAGE_DEFAULT_HEIGHT) {
            $IMAGE_HEIGHT = strlen($labelElement) * 5;
        } else {
            $labelElement = substr($labelElement, 0, $IMAGE_HEIGHT / 4.5 - 3) . "...";
        }
    } elseif (strlen($dataElement) * 4.5 >= $IMAGE_HEIGHT and $IMAGE_ORIENTATION == "horizontal") {
        if ($IMAGE_HEIGHT == $IMAGE_DEFAULT_HEIGHT) {
            $IMAGE_HEIGHT = strlen($dataElement) * 5;
        } else {
            $dataElement = substr($dataElement, 0, $IMAGE_HEIGHT / 4.5 - 3) . "...";
        }
    } elseif (strlen($labelElement) * 4.5 >= $IMAGE_WIDTH and $IMAGE_ORIENTATION == "horizontal") {
        if ($IMAGE_WIDTH == $IMAGE_DEFAULT_WIDTH) {
            $IMAGE_WIDTH = strlen($labelElement) * 5;
        } else {
            $labelElement = substr($labelElement, 0, $IMAGE_HEIGHT / 4.5 - 3) . "...";
        }
    } elseif (strlen($dataElement) * 4.5 >= $IMAGE_WIDTH and $IMAGE_ORIENTATION == "vertical") {
        if ($IMAGE_WIDTH == $IMAGE_DEFAULT_WIDTH) {
            $IMAGE_WIDTH = strlen($dataElement) * 5;
        } else {
            $dataElement = substr($dataElement, 0, $IMAGE_HEIGHT / 4.5 - 3) . "...";
        }
    }
    // Code straightly copied from pChart documentation to draw the graph
    $myData = new pData();
    $myData->addPoints(array_values($dataPoints), $dataElement);
    $myData->setAxisName(0, $dataElement);
    $myData->addPoints(array_keys($dataPoints), $labelElement);
    $myData->setSerieDescription($labelElement, $labelElement);
    $myData->setAbscissa($labelElement);
    $myData->setAbscissaName($labelElement);
    // $myData -> setAxisDisplay(0, AXIS_FORMAT_CUSTOM, "YAxisFormat");
    /* Create the pChart object */
    $myPicture = new pImage($IMAGE_WIDTH, $IMAGE_HEIGHT, $myData);
    $myPicture->drawGradientArea(0, 0, $IMAGE_WIDTH, $IMAGE_HEIGHT, DIRECTION_VERTICAL, array("StartR" => $BACKGROUND_R, "StartG" => $BACKGROUND_G, "StartB" => $BACKGROUND_B, "EndR" => $BACKGROUND_R, "EndG" => $BACKGROUND_G, "EndB" => $BACKGROUND_B, "Alpha" => 100));
    $myPicture->drawGradientArea(0, 0, 500, 500, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 30));
    $myPicture->setFontProperties(array("FontName" => "modules/formulize/libraries/pChart/fonts/arial.ttf", "FontSize" => 8));
    $paddingtoLeft = $IMAGE_WIDTH * 0.15;
    $paddingtoTop = $IMAGE_HEIGHT * 0.2;
    if ($paddingtoTop > 50) {
        $paddingtoTop = 50;
    }
    /* Draw the chart scale */
    $myPicture->setGraphArea($paddingtoLeft, $paddingtoTop, $IMAGE_WIDTH * 0.9, $IMAGE_HEIGHT * 0.88);
    if ($IMAGE_ORIENTATION == "vertical") {
        $myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Pos" => SCALE_POS_TOPBOTTOM, "Mode" => SCALE_MODE_ADDALL_START0, "Decimal" => 0, "MinDivHeight" => 50));
    } else {
        $myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Mode" => SCALE_MODE_ADDALL_START0, "Decimal" => 0, "MinDivHeight" => 50));
    }
    /* Turn on shadow computing */
    $myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
    $Palette = array("0" => array("R" => $BARCOLOR_R, "G" => $BARCOLOR_G, "B" => $BARCOLOR_B, "Alpha" => 100));
    for ($i = 1; $i < $sizeMultiplier; $i++) {
        $Palette[$i] = array("R" => $BARCOLOR_R, "G" => $BARCOLOR_G, "B" => $BARCOLOR_B, "Alpha" => 100);
    }
    // print_r($Palette);
    $myPicture->drawBarChart(array("OverrideColors" => $Palette));
    /* Draw the chart */
    $myPicture->drawBarChart(array("DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Rounded" => TRUE, "Surrounding" => 30, "OverrideColors" => $Palette));
    renderGraph($myPicture, $fid, $frid, $labelElement, $dataElement, $operation, $graphOptions);
    return;
}
<?php

/* CAT:Bar Chart */
/* pChart library inclusions */
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->addPoints(array(13251, 4118, 3087, 1460, 1248, 156, 26, 9, 8), "Hits");
$MyData->setAxisName(0, "Hits");
$MyData->addPoints(array("Firefox", "Chrome", "Internet Explorer", "Opera", "Safari", "Mozilla", "SeaMonkey", "Camino", "Lunascape"), "Browsers");
$MyData->setSerieDescription("Browsers", "Browsers");
$MyData->setAbscissa("Browsers");
$MyData->setAbscissaName("Browsers");
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC, 1);
/* Create the pChart object */
$myPicture = new pImage(500, 500, $MyData);
$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" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the chart scale */
$myPicture->setGraphArea(100, 30, 480, 480);
$myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10, "Pos" => SCALE_POS_TOPBOTTOM));
//
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$myPicture->drawBarChart(array("DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "Rounded" => TRUE, "Surrounding" => 30));
/* Write the legend */
$myPicture->drawLegend(570, 215, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
/* CAT:Scaling */
/* pChart library inclusions */
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->addPoints(array(1700, 2500, 7800, 4500, 3150), "Distance");
$MyData->setAxisName(0, "Maximum distance");
$MyData->setAxisUnit(0, "m");
$MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC);
/* Create the abscissa serie */
$MyData->addPoints(array(1230768000, 1233446400, 1235865600, 1238544000, 1241136000, 1243814400), "Timestamp");
$MyData->setSerieDescription("Timestamp", "Sampled Dates");
$MyData->setAbscissa("Timestamp");
$MyData->setAbscissaName("Dates");
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE);
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* 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" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawScale() - draw the X-Y scales", array("R" => 255, "G" => 255, "B" => 255));
$MyData->setSerieOnAxis("Humidity 2", 1);
$MyData->setSerieOnAxis("Humidity 3", 1);
$MyData->setSerieOnAxis("Vide", 2);
$MyData->setAxisPosition(2, AXIS_POSITION_RIGHT);
$MyData->setAxisName(0, "Temperature");
$MyData->setAxisName(1, "Humidity");
$MyData->setAxisName(2, "Empty value");
/* Associate a color to each axis */
$MyData->setAxisColor(0, array("R" => 102, "G" => 129, "B" => 63));
$MyData->setAxisColor(1, array("R" => 129, "G" => 72, "B" => 63));
$MyData->setAxisColor(2, array("R" => 63, "G" => 89, "B" => 129));
/* Create the abscissa serie */
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
$MyData->setSerieDescription("Labels", "My labels");
$MyData->setAbscissa("Labels");
$MyData->setAbscissaName("Months");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* 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" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawScale() - draw the X-Y scales", array("R" => 255, "G" => 255, "B" => 255));
/* Set the default font */
예제 #7
0
파일: chart.php 프로젝트: captincook/Pony
     $MyData->setPalette("FTP", array("R" => 0, "G" => 39, "B" => 94, "Alpha" => 100));
     if ($enable_http_mode && ($show_http_to_users || $pony_db->priv_is_admin())) {
         $MyData->addPoints($http_count_values, "HTTP");
         $MyData->setPalette("HTTP", array("R" => 150, "G" => 10, "B" => 150, "Alpha" => 100));
         $legend_offset -= 35;
     }
     if ($enable_email_mode && ($show_email_to_users || $pony_db->priv_is_admin())) {
         $MyData->addPoints($email_count_values, "E-mail");
         $MyData->setPalette("E-mail", array("R" => 10, "G" => 150, "B" => 10, "Alpha" => 100));
         $legend_offset -= 40;
     }
     $MyData->setAxisName(0, win2uni($lang['Count']));
     $MyData->addPoints($chart_day_labels, "Labels");
     $MyData->setSerieDescription("Labels", win2uni($lang['Days']));
     $MyData->setAbscissa("Labels");
     $MyData->setAbscissaName(win2uni($lang['Days']));
     $MyData->setAxisDisplay(0, AXIS_FORMAT_METRIC);
     $myPicture = create_common_image($lang['New password additions in the past month'], 680, 230, $MyData);
     $myPicture->drawLineChart(array("DisplayValues" => TRUE, "DisplayColor" => DISPLAY_AUTO));
     $myPicture->drawLegend($legend_offset, 215, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
     $myPicture->stroke();
 } else {
     if ($admin_routine == 'os') {
         $os_list = array();
         if (!$pony_db->get_os_stats($os_list)) {
             die;
         }
         if ($trim_os_versions) {
             $os_list = trim_os_versions($os_list);
         }
         if (count($os_list)) {
include CLASS_PATH . "/pData.class.php";
include CLASS_PATH . "/pDraw.class.php";
include CLASS_PATH . "/pImage.class.php";
include CLASS_PATH . "/pBubble.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(34, 55, 15, 62, 38, 42), "Probe1");
$MyData->addPoints(array(5, 30, 20, 9, 15, 10), "Probe1Weight");
$MyData->addPoints(array(5, 10, -5, -1, 0, -10), "Probe2");
$MyData->addPoints(array(6, 10, 14, 10, 14, 6), "Probe2Weight");
$MyData->setSerieDescription("Probe1", "This year");
$MyData->setSerieDescription("Probe2", "Last year");
$MyData->setAxisName(0, "Current stock");
$MyData->addPoints(array("Apple", "Banana", "Orange", "Lemon", "Peach", "Strawberry"), "Product");
$MyData->setAbscissa("Product");
$MyData->setAbscissaName("Selected Products");
/* 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", "../tmp");
}
/* Set the image map name */
$myPicture->initialiseImageMap("ImageMapBarChart", IMAGE_MAP_STORAGE_FILE, "BarChart", "../tmp");
/* Turn of AAliasing */
$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);
<?php

/* CAT:Mathematical */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
for ($i = 0; $i <= 20; $i++) {
    $MyData->addPoints(rand(10, 30) + $i, "Probe 1");
}
$MyData->setAxisName(0, "Temperatures");
$MyData->setAbscissaName("Samples");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* 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" => "../fonts/Forgotte.ttf", "FontSize" => 11));
$myPicture->drawText(150, 35, "Average temperature", array("FontSize" => 20, "Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 40, 650, 200);
/* Draw the scale */
$scaleSettings = array("XMargin" => 10, "YMargin" => 10, "Floating" => TRUE, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */