source: trunk/xgraph/jpgraph/Examples/canvasex04.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.4 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2// $Id: canvasex04.php,v 1.1 2002/08/27 20:08:57 aditus Exp $
3require_once ('jpgraph/jpgraph.php');
4require_once ('jpgraph/jpgraph_canvas.php');
5require_once ('jpgraph/jpgraph_canvtools.php');
6
7// Define work space
8$xmax=20;
9$ymax=20;
10
11// Setup a basic canvas we can work
12$g = new CanvasGraph(200,100,'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
Note: See TracBrowser for help on using the repository browser.