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