steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/tests .htaccess, NONE, 1.1 test01.php, NONE, 1.1 test02.php, NONE, 1.1 test03.php, NONE, 1.1 test04.php, NONE, 1.1 test05.php, NONE, 1.1 test06.php, NONE, 1.1 test_bargrouped.php, NONE, 1.1 test_pie3d.php, NONE, 1.1 test_pie3d_gd.php, NONE, 1.1

cvs at intevation.de cvs at intevation.de
Fri Oct 14 16:33:06 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/tests
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Graph/tests

Added Files:
	.htaccess test01.php test02.php test03.php test04.php 
	test05.php test06.php test_bargrouped.php test_pie3d.php 
	test_pie3d_gd.php 
Log Message:
Separated Horde Framework from kolab-resource-handlers

--- NEW FILE: .htaccess ---
Allow from all

--- NEW FILE: test01.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test01.php,v 1.7 2004/05/06 20:56:43 chuck Exp $
 *
 * @package Horde_Graph
 */

require_once dirname(__FILE__) . '/../Graph.php';

$graph = &new Horde_Graph(array('height' => 400, 'width' => 400));

$graph->set('title', '3 lines');
$graph->set('ylabel', 'Some Parameters');
$graph->set('xlabel', 'Day of the Week');

$graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri'));
$data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650));
$data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678));
$data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678));

$graph->addPlot('line', array('dataset' => $data1, 'color' => 'red'));
$graph->addPlot('line', array('dataset' => $data2, 'color' => 'green'));
$graph->addPlot('line', array('dataset' => $data3, 'color' => 'blue'));

$graph->draw();

--- NEW FILE: test02.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test02.php,v 1.8 2004/05/06 20:56:43 chuck Exp $
 *
 * @package Horde_Graph
 */

require_once dirname(__FILE__) . '/../Graph.php';

$graph = &new Horde_Graph(array('height' => 400, 'width' => 400));

$graph->set('title', '3 bars');
$graph->set('ylabel', 'Some Parameters');
$graph->set('xlabel', 'Day of the Week');
$graph->set('offsetGridX', .5);

$graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri'));
$data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650));
$data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678));
$data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678));

$graph->addPlot('bar', array('dataset' => $data3, 'offset' => .5, 'color' => 'blue'));
$graph->addPlot('bar', array('dataset' => $data2, 'offset' => 0, 'color' => 'green'));
$graph->addPlot('bar', array('dataset' => $data1, 'offset' => -.5, 'color' => 'red'));

$graph->draw();

--- NEW FILE: test03.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test03.php,v 1.5 2004/05/06 20:56:43 chuck Exp $
 *
 * @package Horde_Graph
 */

require_once dirname(__FILE__) . '/../Graph.php';

$graph = &new Horde_Graph(array('height' => 400, 'width' => 400));

$graph->set('title', '3 scatters');
$graph->set('ylabel', 'Some Parameters');
$graph->set('xlabel', 'Day of the Week');

$graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri'));
$data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650));
$data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678));
$data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678));

$graph->addPlot('scatter', array('dataset' => $data3, 'shape' => 'rectangle', 'color' => 'blue'));
$graph->addPlot('scatter', array('dataset' => $data2, 'shape' => 'triangle', 'color' => 'green'));
$graph->addPlot('scatter', array('dataset' => $data1, 'shape' => 'circle', 'color' => 'red'));

$graph->draw();

--- NEW FILE: test04.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test04.php,v 1.6 2004/05/06 20:56:43 chuck Exp $
 *
 * @package Horde_Graph
 */

require_once dirname(__FILE__) . '/../Graph.php';

$graph = &new Horde_Graph(array('height' => 400, 'width' => 400));

$graph->set('title', 'Scatter & Lines');
$graph->set('ylabel', 'Some Parameters');
$graph->set('xlabel', 'Day of the Week');

$graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri'));
$data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650));
$data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678));
$data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678));

$graph->addPlot('line', array('dataset' => $data1, 'color' => 'red'));
$graph->addPlot('line', array('dataset' => $data2, 'color' => 'green'));
$graph->addPlot('line', array('dataset' => $data3, 'color' => 'blue'));

$graph->addPlot('scatter', array('dataset' => $data3, 'shape' => 'rectangle', 'color' => 'blue'));
$graph->addPlot('scatter', array('dataset' => $data2, 'shape' => 'triangle', 'color' => 'green'));
$graph->addPlot('scatter', array('dataset' => $data1, 'shape' => 'diamond', 'color' => 'red'));

$graph->draw();

--- NEW FILE: test05.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test05.php,v 1.6 2004/05/06 20:56:43 chuck Exp $
 *
 * @package Horde_Graph
 */

require_once dirname(__FILE__) . '/../Graph.php';

$graph = &new Horde_Graph(array('height' => 400, 'width' => 400));

$graph->set('title', 'One datapoint, two axis labels');
$graph->set('ylabel', 'Some Parameters');
$graph->set('xlabel', 'Day of the Week');
$graph->set('offsetGridX', .5);

$graph->addXData(array('Fri', 'Mon'));
$data1 = $graph->addYData(array(8.610));

$graph->addPlot('bar', array('dataset' => $data1, 'color' => 'red'));
$graph->addPlot('scatter', array('dataset' => $data1, 'color' => 'green'));
$graph->addPlot('line', array('dataset' => $data1, 'color' => 'blue'));

$graph->draw();

--- NEW FILE: test06.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test06.php,v 1.6 2004/05/06 20:56:43 chuck Exp $
 *
 * @package Horde_Graph
 */

require_once dirname(__FILE__) . '/../Graph.php';

$graph = &new Horde_Graph(array('height' => 400, 'width' => 400));
$graph->set('title', 'Pie chart');
$graph->set('imgType', 'svg');

$graph->addXData(array('Fri', 'Mon'));
$data1 = $graph->addYData(array(8, 5, 4, 10, 3, 9));

$graph->addChart('pie', array('dataset' => $data1,
                              'outline' => false));

$graph->draw();

--- NEW FILE: test_bargrouped.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test_bargrouped.php,v 1.1 2004/05/06 21:14:56 chuck Exp $
 *
 * @package Horde_Graph
 */

require_once dirname(__FILE__) . '/../Graph.php';

$graph = &new Horde_Graph(array('height' => 400, 'width' => 400));

$graph->set('title', 'Grouped Bars');
$graph->set('ylabel', 'Value');
$graph->set('xlabel', 'Day of the Week');
$graph->set('offsetGridX', .5);

$graph->addXData(array('Fri', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri'));
$data1 = $graph->addYData(array(8.610, 7.940, 3.670, 3.670, 6.940, 8.650));
$data2 = $graph->addYData(array(1.456, 3.001, 5.145, 2.050, 1.998, 1.678));
$data3 = $graph->addYData(array(4.896, 4.500, 4.190, 3.050, 2.888, 3.678));

$graph->addPlot('bargrouped', array('datasets' => array($data1, $data2, $data3), 'colors' => array('red', 'green', 'blue')));

$graph->draw();

--- NEW FILE: test_pie3d.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test_pie3d.php,v 1.1 2004/05/06 20:57:39 chuck Exp $
 *
 * @package Horde_Graph
 */

require_once dirname(__FILE__) . '/../Graph.php';

$graph = &new Horde_Graph(array('height' => 400, 'width' => 400));
$graph->set('title', '3D Pie chart');
$graph->set('imgType', 'svg');

$graph->addXData(array('Fri', 'Mon'));
$data1 = $graph->addYData(array(8, 5, 4, 10, 3, 9));

$graph->addChart('pie3d', array('dataset' => $data1));

$graph->draw();

--- NEW FILE: test_pie3d_gd.php ---
<?php
/**
 * $Horde: framework/Graph/tests/test_pie3d_gd.php,v 1.1 2004/05/06 20:57:39 chuck Exp $
 *
 * @package Horde_Graph
 */

$image = imagecreate(100, 100);

$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$gray = imagecolorallocate($image, 0xC0, 0xC0, 0xC0);
$darkgray = imagecolorallocate($image, 0x90, 0x90, 0x90);
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80);
$darknavy = imagecolorallocate($image, 0x00, 0x00, 0x50);
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00);
$darkred = imagecolorallocate($image, 0x90, 0x00, 0x00);


$angle = 50;
$thickness = 10;

for ($i = $angle + $thickness; $i > $angle; $i--) {
    imagefilledarc($image, 50, $i, 100, $angle, 0, 45, $darknavy, IMG_ARC_PIE);
    imagefilledarc($image, 50, $i, 100, $angle, 45, 75 , $darkgray, IMG_ARC_PIE);
    imagefilledarc($image, 50, $i, 100, $angle, 75, 360 , $darkred, IMG_ARC_PIE);
}

imagefilledarc($image, 50, 50, 100, $angle, 0, 45, $navy, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, $angle, 45, 75 , $gray, IMG_ARC_PIE);
imagefilledarc($image, 50, 50, 100, $angle, 75, 360 , $red, IMG_ARC_PIE);

header('Content-type: image/png');
imagepng($image);





More information about the commits mailing list