canvasex02.php
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php // content="text/plain; charset=utf-8"
// $Id: canvasex02.php,v 1.1 2002/08/27 20:08:57 aditus Exp $
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_canvas.php');
// Setup a basic canvas we can work
$g = new CanvasGraph(400,200,'auto');
$g->SetMargin(5,11,6,11);
$g->SetShadow();
$g->SetMarginColor("teal");
// We need to stroke the plotarea and margin before we add the
// text since we otherwise would overwrite the text.
$g->InitFrame();
// Add a black line
$g->img->SetColor('black');
$g->img->Line(0,0,100,100);
// .. and a circle (x,y,diameter)
$g->img->Circle(100,100,50);
// .. and a filled circle (x,y,diameter)
$g->img->SetColor('red');
$g->img->FilledCircle(200,100,50);
// .. add a rectangle
$g->img->SetColor('green');
$g->img->FilledRectangle(10,10,50,50);
// .. add a filled rounded rectangle
$g->img->SetColor('green');
$g->img->FilledRoundedRectangle(300,30,350,80,10);
// .. with a darker border
$g->img->SetColor('darkgreen');
$g->img->RoundedRectangle(300,30,350,80,10);
// Stroke the graph
$g->Stroke();
?>