| 1 | <?php // content="text/plain; charset=utf-8" | 
|---|
| 2 | // $Id: canvasex06.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 | require_once ('jpgraph/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 | $shape->IndentedRectangle(1,2,15,15,8,8,CORNER_TOPLEFT,'khaki'); | 
|---|
| 31 |  | 
|---|
| 32 | $shape->IndentedRectangle(1,20,15,15,8,8,CORNER_BOTTOMLEFT,'khaki'); | 
|---|
| 33 |  | 
|---|
| 34 | $shape->IndentedRectangle(20,2,15,15,8,8,CORNER_TOPRIGHT,'khaki'); | 
|---|
| 35 |  | 
|---|
| 36 | $shape->IndentedRectangle(20,20,15,15,8,8,CORNER_BOTTOMRIGHT,'khaki'); | 
|---|
| 37 |  | 
|---|
| 38 | // Stroke the graph | 
|---|
| 39 | $g->Stroke(); | 
|---|
| 40 |  | 
|---|
| 41 | ?> | 
|---|
| 42 |  | 
|---|