Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
// $Id: canvasex05.php,v 1.1 2002/08/27 20:08:57 aditus Exp $
3
include "../jpgraph.php";
4
include "../jpgraph_canvas.php";
5
include "../jpgraph_canvtools.php";
6
 
7
// Define work space
8
$xmax=40;
9
$ymax=40;
10
 
11
// Setup a basic canvas we can work
12
$g = new CanvasGraph(400,200,'auto');
13
$g->SetMargin(5,11,6,11);
14
$g->SetShadow();
15
$g->SetMarginColor("teal");
16
 
17
// We need to stroke the plotarea and margin before we add the
18
// text since we otherwise would overwrite the text.
19
$g->InitFrame();
20
 
21
// Create a new scale
22
$scale = new CanvasScale($g);
23
$scale->Set(0,$xmax,0,$ymax);
24
 
25
// The shape class is wrapper around the Imgae class which translates
26
// the coordinates for us
27
$shape = new Shape($g,$scale);
28
$shape->SetColor('black');
29
 
30
 
31
// Add a black line
32
$shape->SetColor('black');
33
$shape->Line(0,0,20,20);
34
 
35
// .. and a circle (x,y,diameter)
36
$shape->Circle(5,14,2);
37
 
38
// .. and a filled circle (x,y,diameter)
39
$shape->SetColor('red');
40
$shape->FilledCircle(11,8,3);
41
 
42
// .. add a rectangle
43
$shape->SetColor('green');
44
$shape->FilledRectangle(15,8,19,14);
45
 
46
// .. add a filled rounded rectangle
47
$shape->SetColor('green');
48
$shape->FilledRoundedRectangle(2,3,8,6);
49
// .. with a darker border
50
$shape->SetColor('darkgreen');
51
$shape->RoundedRectangle(2,3,8,6);
52
 
53
 
54
// Stroke the graph
55
$g->Stroke();
56
 
57
?>
58