コード例 #1
0
require 'Image/Graph.php';
$chart_colors = array('green@0.2', 'blue@0.2', 'red@0.2', 'yellow@0.2', 'orange@0.2', 'purple@0.2', 'green@0.8', 'blue@0.8', 'red@0.8', 'yellow@0.8', 'orange@0.8', 'purple@0.8', 'green@0.4', 'blue@0.4', 'red@0.4', 'yellow@0.4', 'orange@0.4', 'purple@0.4', 'green@0.6', 'blue@0.6', 'red@0.6', 'yellow@0.6', 'orange@0.6', 'purple@0.6', 'green', 'blue', 'red', 'yellow', 'orange', 'purple');
if (!empty($_GET['thumb'])) {
    $out = array('limit' => 7, 'width' => 400, 'height' => 200, 'center' => 100, 'margin_top' => 50, 'margin_bottom' => 20, 'margin_left' => 160, 'margin_right' => 30);
} else {
    $out = array('limit' => 25, 'width' => 700, 'height' => 500, 'center' => 250, 'margin_top' => 60, 'margin_bottom' => 30, 'margin_left' => 180, 'margin_right' => 30);
}
// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300));
// add a TrueType font
$Font =& $Graph->addNew('ttf_font', $chart_font);
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
// create the plotareas
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('SpamAssassin rules', 12)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 60), 5));
$Legend->setPlotarea($Plotarea);
$Legend->setAlignment(IMAGE_GRAPH_ALIGN_VERTICAL);
$Plotarea->hideAxis();
// create the dataset
$Dataset =& Image_Graph::factory('dataset');
$select = "SELECT rule_name, rule_count " . "FROM maia_sa_rules WHERE rule_count > 0 ORDER BY rule_count DESC, rule_name ASC LIMIT " . $out['limit'];
$sth = $dbh->prepare($select);
$res = $sth->execute();
if (PEAR::isError($sth)) {
    die($sth->getMessage());
}
$keys = array();
$values = array();
if ($res->numRows()) {
    $sum = 0;
コード例 #2
0
 * None specific
 * 
 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <*****@*****.**>
 */
require_once 'Image/Graph.php';
require_once 'Image/Canvas.php';
$Canvas =& Image_Canvas::factory('png', array('width' => 400, 'height' => 200));
// create the graph
$Graph =& Image_Graph::factory('graph', $Canvas);
$Font =& $Graph->addNew('font', 'Verdana');
$Font->setSize(8);
$Graph->setFont($Font);
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Gradient Filled Step Chart', 11)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), Image_Graph::factory('title', array('Anybody recognize?', array('size' => 7, 'color' => 'gray@0.6', 'angle' => 270))), 98), 5));
$Grid =& $Plotarea->addNew('line_grid', array(), IMAGE_GRAPH_AXIS_Y);
$Grid->setLineColor('white@0.4');
$Dataset =& Image_Graph::factory('dataset');
$Dataset->addPoint(1, 20);
$Dataset->addPoint(2, 10);
$Dataset->addPoint(3, 35);
$Dataset->addPoint(4, 5);
$Dataset->addPoint(5, 18);
$Dataset->addPoint(6, 33);
$Plot =& $Plotarea->addNew('step', array(&$Dataset));
$Fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'darkgreen', 'white'));
$Plot->setFillStyle($Fill);
$Fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'yellow', 'darkred'));
$Plotarea->setFillStyle($Fill);
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
コード例 #3
0
ファイル: driver_pdf.php プロジェクト: Magomogo/Image_Graph
 * 
 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <*****@*****.**>
 */
error_reporting(E_ALL);
require_once 'Image/Graph.php';
require_once 'Image/Canvas.php';
$Canvas =& Image_Canvas::factory('cpdf', array('page' => 'A3', 'align' => 'center', 'width' => 600, 'height' => 400));
// create the graph
$Graph =& Image_Graph::factory('graph', $Canvas);
$Font =& $Graph->addNew('font', 'Verdana');
$Font->setSize(7);
$Graph->setFont($Font);
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Image_Graph Demonstration', 12)), Image_Graph::vertical(Image_Graph::vertical($Plotarea_Weather = Image_Graph::factory('plotarea'), $Legend_Weather = Image_Graph::factory('legend'), 85), Image_Graph::horizontal(Image_Graph::vertical(Image_Graph::vertical(Image_Graph::factory('title', array('Demonstration of Mathematical Functions', 10)), $Plotarea_SinCos = Image_Graph::factory('plotarea', 'axis'), 5), $Legend_SinCos = Image_Graph::factory('legend'), 90), $Plotarea_Car = Image_Graph::factory('plotarea'), 50), 60), 5));
$Legend_Weather->setPlotarea($Plotarea_Weather);
$Legend_Weather->setFontSize(7);
$Legend_SinCos->setPlotarea($Plotarea_SinCos);
$Legend_SinCos->setFontSize(8);
$GridY_Weather =& $Plotarea_Weather->addNew('line_grid', null, IMAGE_GRAPH_AXIS_Y);
$GridY_Weather->setLineColor('gray@0.1');
$Marker_AverageSpan =& $Plotarea_Weather->addNew('Image_Graph_Axis_Marker_Area', IMAGE_GRAPH_AXIS_Y);
$Marker_AverageSpan->setFillColor('green@0.2');
$Marker_AverageSpan->setLowerBound(3.8);
$Marker_AverageSpan->setUpperBound(11.4);
$Marker_Average =& $Plotarea_Weather->addNew('Image_Graph_Axis_Marker_Line', IMAGE_GRAPH_AXIS_Y);
$Marker_Average->setLineColor('blue@0.4');
$Marker_Average->setValue(7.7);
$Dataset_Rainfall =& Image_Graph::factory('dataset');
$Dataset_Rainfall->addPoint('Jan', 60);
コード例 #4
0
ファイル: horizontal.php プロジェクト: hbustun/agilebill
 * $Id: horizontal.php,v 1.2 2005/10/05 20:56:38 nosey Exp $
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <*****@*****.**>
 */
error_reporting(E_ALL);
include_once 'Image/Graph.php';
include_once 'Image/Canvas.php';
$Dataset =& Image_Graph::factory('dataset', array(array('A' => 10, 'B' => 9, 'C' => 4, 'D' => 6, 'E' => 5, 'F' => 9, 'G' => 11, 'H' => 8)));
$Dataset2 =& Image_Graph::factory('dataset', array(array('A' => 121, 'B' => 134, 'C' => 192, 'D' => 213, 'E' => 123, 'F' => 167, 'G' => 153, 'H' => 149)));
$Canvas =& Image_Canvas::factory('png', array('width' => 800, 'height' => 400));
// create the graph
$Graph =& Image_Graph::factory('graph', &$Canvas);
$Graph->setFont(Image_Graph::factory('font', array('Courier New')));
$Graph->setFontSize(8);
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Vertical & Horizontal Plots', 11)), Image_Graph::vertical(Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Plotarea2 = Image_Graph::factory('plotarea', array('category', 'axis', 'horizontal'))), $Legend = Image_Graph::factory('legend'), 90), 7));
$Legend->setPlotarea($Plotarea);
$GridY =& $Plotarea->addNew('line_grid', null, IMAGE_GRAPH_AXIS_Y);
$Plot =& $Plotarea->addNew('step', &$Dataset);
$Plot->setFillColor('blue@0.2');
$Marker =& Image_Graph::factory('value_marker', IMAGE_GRAPH_VALUE_Y);
$Marker->setFontSize(7);
$Plot->setMarker($Marker);
$Plot12 =& $Plotarea->addNew('line', &$Dataset2, IMAGE_GRAPH_AXIS_Y_SECONDARY);
$Plot12->setLineColor('red');
$Plot->setTitle('Primary axis');
$Plot12->setTitle('Secondary axis');
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
$AxisX->setTitle('X Data', array('size' => 10));
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
$AxisY->setTitle('Y Data', array('size' => 10));
コード例 #5
0
ファイル: misc02.php プロジェクト: Magomogo/Image_Graph
$Graph =& Image_Graph::factory('graph', array(600, 300));
$Graph->setBackground(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'lightsteelblue', 'papayawhip')));
// create a random dataset to use for demonstrational purposes
$DataSet =& Image_Graph::factory('function', array(1, 9, 'salaries', 8));
$DataSet2 =& Image_Graph::factory('dataset');
$DataSet2->addPoint('CEO', 10);
$DataSet2->addPoint('TAP', 32);
$DataSet2->addPoint('TBF', 13);
$DataSet2->addPoint('ABC', 19);
$DataSet2->addPoint('QED', 26);
// create and set the plot font
$Font =& $Graph->addNew('font', 'Verdana');
$Font->setSize(7);
$Graph->setFont($Font);
// add a plot area in a vertical layout to display a title on top
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Annual income', 11)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), Image_Graph::vertical($Plotarea2 = Image_Graph::factory('plotarea'), $Legend2 = Image_Graph::factory('legend'), 90)), 5), 5);
$Legend2->setPlotarea($Plotarea2);
// create a bar grid and fill it with a gradient fill white->lightgray
$Grid =& $Plotarea->addNew('bar_grid', null, IMAGE_GRAPH_AXIS_Y);
$Grid->setFillColor('gray@0.2');
$Plotarea->setFillColor('gray@0.2');
// add a line plot to the plotarea based on the function dataset
$Plot =& $Plotarea->addNew('line', array(&$DataSet));
// add coins-icon as marker
$Plot->setMarker(Image_Graph::factory('Image_Graph_Marker_Icon', './images/coins.png'));
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
// make x-axis start at 0
$AxisX->forceMinimum(0);
// make x-axis end at 9
$AxisX->forceMaximum(9);
コード例 #6
0
require 'Image/Graph.php';
$chart_colors = get_chart_colors();
if (!empty($_GET['thumb'])) {
    $out = array('limit' => 7, 'width' => 400, 'height' => 200, 'center' => 100, 'margin_top' => 50, 'margin_bottom' => 20, 'margin_left' => 160, 'margin_right' => 30);
} else {
    $out = array('limit' => 25, 'width' => 700, 'height' => 500, 'center' => 250, 'margin_top' => 60, 'margin_bottom' => 30, 'margin_left' => 180, 'margin_right' => 30);
}
// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300));
// add a TrueType font
$Font =& $Graph->addNew('ttf_font', $chart_font);
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
// create the plotareas
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Mail Stats', 12)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 60), 5));
$Legend->setPlotarea($Plotarea);
$Legend->setAlignment(IMAGE_GRAPH_ALIGN_VERTICAL);
$Plotarea->hideAxis();
// create the dataset
$Dataset =& Image_Graph::factory('dataset');
if ($id == 0) {
    $select = "SELECT SUM(total_suspected_ham_items) as sh, \n                         SUM(total_ham_items) as h, \n                         SUM(total_wl_items) as wl, \n                         SUM(total_bl_items) as bl, \n                         SUM(total_suspected_spam_items) as ss, \n                         SUM(total_spam_items) as s, \n                         SUM(total_fp_items) as fp, \n                         SUM(total_fn_items) as fn, \n                         SUM(total_virus_items) as v, \n                         SUM(total_bad_header_items) as bh, \n                         SUM(total_banned_file_items) as bf,\n                         SUM(total_oversized_items) as os\n                  FROM maia_stats";
    $sth = $dbh->query($select);
} else {
    $select = "SELECT total_suspected_ham_items as sh, total_ham_items as h, total_wl_items as wl, total_bl_items as bl, total_suspected_spam_items as ss, " . "total_spam_items as s, total_fp_items as fp, total_fn_items as fn, total_virus_items as v, total_bad_header_items as bh, total_banned_file_items as bf, " . "total_oversized_items as os " . "FROM maia_stats " . "WHERE user_id = ?";
    $sth = $dbh->query($select, $id);
}
$items = array();
if ($row = $sth->fetchrow()) {
    foreach ($row as $key => $value) {
コード例 #7
0
ファイル: misc01.php プロジェクト: hbustun/agilebill
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('Image_Graph', array(600, 400));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
$Dataset_SmoothedLine =& Image_Graph::factory('dataset');
$Dataset_SmoothedLine->addPoint('DK', 6);
$Dataset_SmoothedLine->addPoint('UK', 8);
$Dataset_SmoothedLine->addPoint('PO', 2);
$Dataset_SmoothedLine->addPoint('NL', 4);
$Graph->setFont($Font);
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('A Sample Demonstrating Many-a-thing', 15)), Image_Graph::vertical(Image_Graph::horizontal($Plotarea_BarAndLine = Image_Graph::factory('plotarea'), Image_Graph::vertical($Plotarea_SmoothedLine = Image_Graph::factory('plotarea'), $Plotarea_Radar = Image_Graph::factory('Image_Graph_Plotarea_Radar')), 65), $Legend = Image_Graph::factory('legend'), 90), 9));
$Legend->setPlotarea($Plotarea_BarAndLine);
$Legend->setPlotarea($Plotarea_SmoothedLine);
$Legend->setPlotarea($Plotarea_Radar);
//    $Plotarea_SmoothedLine->setFillStyle(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'lightred', 'brown')));
$Plotarea_SmoothedLine->setBorderColor('black');
$Plotarea_SmoothedLine->showShadow();
$Plotarea_SmoothedLine->setPadding(15);
$Plotarea_SmoothedLine->setBackground(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'brown')));
// create a Y grid
$Grid_Radar =& $Plotarea_Radar->addNew('line_grid', IMAGE_GRAPH_AXIS_Y);
$Grid_Radar->setLineColor('lightgrey');
// create a Y grid
$Grid_BarAndLine =& $Plotarea_BarAndLine->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y);
// that is light gray in color
$Grid_BarAndLine->setFillColor('blue@0.3');
コード例 #8
0
ファイル: all_negative.php プロジェクト: Magomogo/Image_Graph
 * 
 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <*****@*****.**>
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(600, 300));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(10);
$Graph->setFont($Font);
// setup the plotarea, legend and their layout
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Arrow Position on All Negative', 12)), Image_Graph::horizontal($Plotarea1 = Image_Graph::factory('plotarea'), $Plotarea2 = Image_Graph::factory('plotarea'), 50), 5));
$Dataset1 =& Image_Graph::factory('dataset');
$Dataset1->addPoint('a', 19);
$Dataset1->addPoint('b', 12);
$Dataset1->addPoint('c', 16);
$Dataset1->addPoint('d', 7);
$Dataset1->addPoint('e', 21);
$Dataset1->addPoint('f', 14);
$Dataset1->addPoint('g', 16);
$Plot1 =& $Plotarea1->addNew('line', array(&$Dataset1));
$Plot1->setLineColor('red');
$AxisY1 =& $Plotarea1->getAxis('y');
$AxisY1->showArrow();
$Dataset2 =& Image_Graph::factory('dataset');
$Dataset2->addPoint('a', -19);
$Dataset2->addPoint('b', -12);
コード例 #9
0
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 15 pixels
$Font->setSize(8);
// add a title using the created font
for ($i = 0; $i < 2; $i++) {
    for ($j = 0; $j < 2; $j++) {
        $Axis['X'][$i * 2 + $j] = 'axis' . ($i % 2 == 0 ? '' : '_log');
        $Axis['Y'][$i * 2 + $j] = 'axis' . ($j % 2 == 0 ? '' : '_log');
    }
}
for ($i = 0; $i < 4; $i++) {
    $Plotarea[$i] =& Image_Graph::factory('plotarea', array($Axis['X'][$i], $Axis['Y'][$i]));
}
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Logarithmic Axis', 11)), Image_Graph::vertical(Image_Graph::horizontal(Image_Graph::vertical(Image_Graph::factory('title', array('Normal Y-Axis', array('size' => 10, 'angle' => 90))), Image_Graph::factory('title', array('Logarithmic Y-Axis', array('size' => 10, 'angle' => 90)))), Image_Graph::horizontal(Image_Graph::vertical(Image_Graph::factory('title', array('Normal X-Axis', 10)), Image_Graph::vertical($Plotarea[0], $Plotarea[1]), 7), Image_Graph::vertical(Image_Graph::factory('Image_Graph_Title', array('Logarithmic X-Axis', 10)), Image_Graph::vertical($Plotarea[2], $Plotarea[3]), 7)), 4), $Legend = Image_Graph::factory('Image_Graph_Legend'), 92), 5));
$Legend->setPlotarea($Plotarea[0]);
$Dataset = Image_Graph::factory('dataset');
$i = 1;
while ($i <= 10) {
    $Dataset->addPoint($i, $i * $i);
    $i++;
}
for ($i = 0; $i < 4; $i++) {
    $Plotarea[$i]->addNew('line_grid', false, IMAGE_GRAPH_AXIS_X);
    $Plotarea[$i]->addNew('line_grid', false, IMAGE_GRAPH_AXIS_Y);
    $Axis =& $Plotarea[$i]->getAxis(IMAGE_GRAPH_AXIS_Y);
    if ($i % 2 == 1) {
        $Axis->setLabelInterval(array(30, 45, 50, 65, 100));
    }
    $Axis->forceMinimum(25);
コード例 #10
0
ファイル: axis_direction.php プロジェクト: hbustun/agilebill
 * 
 * Main purpose: 
 * Axis direction
 * 
 * Other: 
 * None specific
 * 
 * $Id: axis_direction.php,v 1.1 2005/09/30 18:59:17 nosey Exp $
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <*****@*****.**>
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(600, 300));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(10);
$Graph->setFont($Font);
// setup the plotarea, legend and their layout
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Changing Axis Direction', 12)), Image_Graph::horizontal($Plotarea1 = Image_Graph::factory('plotarea'), $Plotarea2 = Image_Graph::factory('plotarea'), 50), 5));
$Dataset =& Image_Graph::factory('random', array(10, 2, 15, true));
$Plot1 =& $Plotarea1->addNew('line', array(&$Dataset));
$Plot1->setLineColor('red');
$Plot2 =& $Plotarea2->addNew('line', array(&$Dataset));
$Plot2->setLineColor('red');
$AxisY =& $Plotarea2->getAxis('y');
$AxisY->setInverted(true);
// output the Graph
$Graph->done();
コード例 #11
0
    $Graph =& Image_Graph::factory('graph', array($width, $height));
} else {
    // Create the graph area, legends on bottom -- Alejandro
    $Graph =& new Image_Graph(array('driver' => 'gd', 'width' => $width, 'height' => $height));
}
if ($chart_type == 15 || $chart_type == 17) {
    $Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array($title, 35)), Image_Graph::vertical($Plotarea = Image_Graph::factory('Image_Graph_Plotarea_Map', 'world_map6'), $Legend = Image_Graph::factory('legend'), 90), 10));
} elseif ($yaxis_scale == 1) {
    if ($style == "pie") {
        $Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array($title, 16)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 80), 10));
    } else {
        $Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array($title, 16)), Image_Graph::vertical($Plotarea = Image_Graph::factory('plotarea', array('axis', 'axis_log')), $Legend = Image_Graph::factory('legend'), 80), 10));
    }
} else {
    if ($style == "pie") {
        $Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array($title, 16)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 80), 10));
    } else {
        $Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array($title, 16)), Image_Graph::vertical($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 85), 10));
    }
}
$rv = ini_get("safe_mode");
if ($rv != 1) {
    $font_name = "Verdana";
    if (check_font($font_name)) {
        $Font =& $Graph->addNew('font', $font_name);
    } else {
        $Font =& $Graph->addNew('Image_Graph_Font');
        error_log(__FILE__ . ":" . __LINE__ . ": WARNING: " . $font_name . " could not be resolved into a readable font file. Check \"Image/Canvas/Fonts/fontmap.txt\" in your PEAR directory. This directory can be found by pear 'config-show | grep \"PEAR directory\"'. Falling back to default font without the possibility to adjust any font sizes");
    }
    if ($chart_type == 15 || $chart_type == 17) {
        $Font->setSize(8);
コード例 #12
0
function group_type_graph()
{
    $grouptypes = get_records_sql_array("\n        SELECT grouptype, jointype, COUNT(id) AS groups\n        FROM {group}\n        WHERE deleted = 0\n        GROUP BY grouptype, jointype\n        ORDER BY groups DESC", array());
    if (count($grouptypes) > 1) {
        $dataarray = array();
        foreach ($grouptypes as &$t) {
            $strtype = get_string('name', 'grouptype.' . $t->grouptype);
            $strjoin = get_string('membershiptype.abbrev.' . $t->jointype, 'group');
            $dataarray[$strtype . '/' . $strjoin] = $t->groups;
        }
        ksort($dataarray);
        arsort($dataarray);
        require_once get_config('libroot') . "pear/Image/Graph.php";
        $Graph =& Image_Graph::factory('graph', array(300, 200));
        $Font =& $Graph->addNew('font', 'Vera');
        $Font->setSize(9);
        $Graph->setFont($Font);
        $Graph->add(Image_Graph::vertical(Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 60), $Date = Image_Graph::factory('title', array(format_date(time(), 'strftimew3cdate'), 7)), 96));
        $Date->setAlignment(IMAGE_GRAPH_ALIGN_RIGHT);
        $DateFont =& $Graph->addNew('font', 'Vera');
        $DateFont->setColor('gray@0.8');
        $Date->setFont($DateFont);
        $Legend->setPlotArea($Plotarea);
        $Legend->setFontSize(6);
        $Plotarea->hideAxis();
        $Dataset =& Image_Graph::factory('dataset', array($dataarray));
        $Plot =& $Plotarea->addNew('pie', $Dataset);
        $Plot->setLineColor('black');
        $FillArray =& Image_Graph::factory('Image_Graph_Fill_Array');
        $Plot->setFillStyle($FillArray);
        $FillArray->addColor('blue@0.6');
        $FillArray->addColor('green@0.6');
        $FillArray->addColor('red@0.6');
        $FillArray->addColor('yellow@0.6');
        $FillArray->addColor('orange@0.6');
        $FillArray->addColor('black@0.6');
        $Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_VALUE_Y);
        $Marker->setBorderColor('white');
        $Marker->setFontSize(7);
        $PointingMarker =& $Plot->addNew('Image_Graph_Marker_Pointing_Angular', array(20, &$Marker));
        $Plot->setMarker($PointingMarker);
        $Graph->done(array('filename' => stats_graph_path('grouptypes')));
    }
}
コード例 #13
0
ファイル: antialias.php プロジェクト: hbustun/agilebill
 */
// include libraries
require_once 'Image/Graph.php';
require_once 'Image/Canvas.php';
// create a PNG canvas and enable antialiasing (canvas implementation)
$Canvas =& Image_Canvas::factory('png', array('width' => 600, 'height' => 300, 'antialias' => 'native'));
// create the graph
$Graph =& Image_Graph::factory('graph', $Canvas);
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 8 pixels
$Font->setSize(8);
// set the font
$Graph->setFont($Font);
// create the layout
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Antialiased Sample Chart', 12)), Image_Graph::vertical(Image_Graph::horizontal($Plotarea1 = Image_Graph::factory('plotarea'), $Plotarea2 = Image_Graph::factory('plotarea')), $Legend = Image_Graph::factory('legend'), 80), 5));
// add grids
$Grid =& $Plotarea1->addNew('line_grid', IMAGE_GRAPH_AXIS_Y);
$Grid->setLineColor('silver');
$Grid =& $Plotarea2->addNew('line_grid', IMAGE_GRAPH_AXIS_Y);
$Grid->setLineColor('silver');
// setup legend
$Legend->setPlotarea($Plotarea1);
$Legend->setPlotarea($Plotarea2);
// create the dataset
$Datasets = array(Image_Graph::factory('random', array(10, 2, 15, true)), Image_Graph::factory('random', array(10, 2, 15, true)), Image_Graph::factory('random', array(10, 2, 15, true)));
// create the plot as stacked area chart using the datasets
$Plot =& $Plotarea1->addNew('Image_Graph_Plot_Area', array($Datasets, 'stacked'));
// set names for datasets (for legend)
$Datasets[0]->setName('Jylland');
$Datasets[1]->setName('Fyn');
コード例 #14
0
require 'Image/Graph.php';
$chart_colors = array('green@0.2', 'blue@0.2', 'red@0.2', 'yellow@0.2', 'orange@0.2', 'purple@0.2', 'green@0.8', 'blue@0.8', 'red@0.8', 'yellow@0.8', 'orange@0.8', 'purple@0.8', 'green@0.4', 'blue@0.4', 'red@0.4', 'yellow@0.4', 'orange@0.4', 'purple@0.4', 'green@0.6', 'blue@0.6', 'red@0.6', 'yellow@0.6', 'orange@0.6', 'purple@0.6', 'green', 'blue', 'red', 'yellow', 'orange', 'purple');
if (!empty($_GET['thumb'])) {
    $out = array('limit' => 7, 'width' => 400, 'height' => 200, 'center' => 100, 'margin_top' => 50, 'margin_bottom' => 20, 'margin_left' => 160, 'margin_right' => 30);
} else {
    $out = array('limit' => 25, 'width' => 700, 'height' => 500, 'center' => 250, 'margin_top' => 60, 'margin_bottom' => 30, 'margin_left' => 180, 'margin_right' => 30);
}
// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300));
// add a TrueType font
$Font =& $Graph->addNew('ttf_font', $chart_font);
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
// create the plotareas
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Virus Distribution', 12)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 60), 5));
$Legend->setPlotarea($Plotarea);
$Legend->setAlignment(IMAGE_GRAPH_ALIGN_VERTICAL);
$Plotarea->hideAxis();
// create the dataset
$Dataset =& Image_Graph::factory('dataset');
$select = "SELECT virus_name, count FROM maia_viruses WHERE count > 0 ORDER BY count DESC, virus_name ASC LIMIT " . $out['limit'];
$sth = $dbh->query($select);
$keys = array();
$values = array();
if ($sth->numRows()) {
    $sum = 0;
    while ($row = $sth->fetchrow()) {
        $Dataset->addPoint($row["virus_name"], $row["count"], $row["virus_name"]);
        $keys[] = $row["virus_name"];
        $values[] = $row["count"];
コード例 #15
0
ファイル: gradient_pie.php プロジェクト: Magomogo/Image_Graph
 * 
 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <*****@*****.**>
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Gradient Filled Donut/Pie Chart', 12)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 60), 5));
$Legend->setPlotarea($Plotarea);
$Legend->setAlignment(IMAGE_GRAPH_ALIGN_VERTICAL);
// create the dataset
$Dataset =& Image_Graph::factory('dataset');
$Dataset->addPoint('Beef', rand(1, 10), 'beef');
$Dataset->addPoint('Pork', rand(1, 10), 'pork');
$Dataset->addPoint('Poultry', rand(1, 10), 'poultry');
$Dataset->addPoint('Camels', rand(1, 10), 'camels');
$Dataset->addPoint('Other', rand(1, 10), 'other');
// create the dataset
$Dataset2 =& Image_Graph::factory('dataset');
$Dataset2->addPoint('Beer', rand(1, 10), 'beer');
$Dataset2->addPoint('Wine', rand(1, 10), 'wine');
$Dataset2->addPoint('Alcohol', rand(1, 10), 'alcohol');
$Dataset2->addPoint('Coffee', rand(1, 10), 'coffee');
コード例 #16
0
ファイル: driver_swf02.php プロジェクト: hbustun/agilebill
require_once 'Image/Graph.php';
require_once 'Image/Canvas.php';
$Canvas =& Image_Canvas::factory('swf', array('width' => 600, 'height' => 400));
// create the graph
$Graph =& Image_Graph::factory('graph', $Canvas);
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 15 pixels
$Font->setSize(15);
// add a title using the created font
$Dataset_SmoothedLine =& Image_Graph::factory('dataset');
$Dataset_SmoothedLine->addPoint('DK', 6);
$Dataset_SmoothedLine->addPoint('UK', 8);
$Dataset_SmoothedLine->addPoint('PO', 2);
$Dataset_SmoothedLine->addPoint('NL', 4);
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Layout and Legend Sample', &$Font)), Image_Graph::horizontal(Image_Graph::vertical(Image_Graph::horizontal(Image_Graph::factory('title', array('This is the Y Axis', &$_Image_Graph_verticalFont)), Image_Graph::vertical($Plotarea_BarAndLine = Image_Graph::factory('plotarea'), Image_Graph::factory('title', array('This is the X Axis', &$_Image_Graph_font)), 95), 5), $Legend_BarAndLine = Image_Graph::factory('legend'), 95), Image_Graph::vertical(Image_Graph::horizontal($Plotarea_SmoothedLine = Image_Graph::factory('plotarea'), $Legend_SmoothedLine = Image_Graph::factory('legend'), 80), $Plotarea_Radar = Image_Graph::factory('Image_Graph_Plotarea_Radar')), 65), 9));
$Legend_BarAndLine->setPlotarea($Plotarea_BarAndLine);
$Legend_SmoothedLine->setPlotarea($Plotarea_SmoothedLine);
// create a Y grid
$Grid_Radar =& $Plotarea_Radar->addNew('line_grid', IMAGE_GRAPH_AXIS_Y);
$Grid_Radar->setLineColor('lightgrey');
// create a Y grid
$Grid_BarAndLine =& $Plotarea_BarAndLine->addNew('bar_grid', IMAGE_GRAPH_AXIS_Y);
// that is light gray in color
$Grid_BarAndLine->setFillStyle(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'lightgrey')));
// create a Y grid
$Grid_SmoothedLine =& $Plotarea_SmoothedLine->addNew('line_grid', IMAGE_GRAPH_AXIS_Y);
$Grid_SmoothedLine->setLineColor('lightgrey');
// create the 1st dataset
//$Dataset_SmoothedLine =& new Image_RandomDataset(4, 2, 15, true);
// create the 1st plot as smoothed area chart using the 1st dataset
コード例 #17
0
ファイル: plot_pie_rotate.php プロジェクト: hbustun/agilebill
 * 
 * $Id: plot_pie_rotate.php,v 1.1 2005/09/30 18:59:17 nosey Exp $
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <*****@*****.**>
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 7 pixels
$Font->setSize(7);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Meat Export', 12)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 70), 5));
$Legend->setPlotarea($Plotarea);
// create the 1st dataset
$Dataset1 =& Image_Graph::factory('dataset');
$Dataset1->addPoint('Beef', rand(1, 10));
$Dataset1->addPoint('Pork', rand(1, 10));
$Dataset1->addPoint('Poultry', rand(1, 10));
$Dataset1->addPoint('Camels', rand(1, 10));
$Dataset1->addPoint('Other', rand(1, 10));
// create the 1st plot as smoothed area chart using the 1st dataset
$Plot =& $Plotarea->addNew('pie', array(&$Dataset1));
$Plotarea->hideAxis();
// create a Y data value marker
$Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_PCT_Y_TOTAL);
// create a pin-point marker type
$PointingMarker =& $Plot->addNew('Image_Graph_Marker_Pointing_Angular', array(20, &$Marker));
コード例 #18
0
 * 
 * $Id: plot_bar_horizontal.php,v 1.1 2005/09/08 19:02:17 nosey Exp $
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <*****@*****.**>
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(600, 300));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Vertical and Horizontal Bar Chart', 12)), Image_Graph::horizontal($Plotarea1 = Image_Graph::factory('plotarea'), $Plotarea2 = Image_Graph::factory('plotarea', array('category', 'axis', 'horizontal')), 50), 5));
$Dataset[0] =& Image_Graph::factory('dataset');
$Dataset[1] =& Image_Graph::factory('dataset');
$Dataset[2] =& Image_Graph::factory('dataset');
$Dataset[0]->addPoint('A', 1);
$Dataset[0]->addPoint('B', 4);
$Dataset[0]->addPoint('C', -1);
$Dataset[0]->addPoint('D', 2);
$Dataset[0]->addPoint('E', 1);
$Dataset[0]->addPoint('F', 2);
$Dataset[0]->addPoint('G', 3);
$Dataset[1]->addPoint('A', 2);
$Dataset[1]->addPoint('B', -3);
$Dataset[1]->addPoint('C', -2);
$Dataset[1]->addPoint('D', 3);
$Dataset[1]->addPoint('E', 3);