[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | // $Id: canvasex01.php,v 1.3 2002/10/23 08:17:23 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,300,'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 | // Draw a text box in the middle
|
---|
| 17 | $txt="This\nis\na TEXT!!!";
|
---|
| 18 | $t = new Text($txt,200,10);
|
---|
| 19 | $t->SetFont(FF_ARIAL,FS_BOLD,40);
|
---|
| 20 |
|
---|
| 21 | // How should the text box interpret the coordinates?
|
---|
| 22 | $t->Align('center','top');
|
---|
| 23 |
|
---|
| 24 | // How should the paragraph be aligned?
|
---|
| 25 | $t->ParagraphAlign('center');
|
---|
| 26 |
|
---|
| 27 | // Add a box around the text, white fill, black border and gray shadow
|
---|
| 28 | $t->SetBox("white","black","gray");
|
---|
| 29 |
|
---|
| 30 | // Stroke the text
|
---|
| 31 | $t->Stroke($g->img);
|
---|
| 32 |
|
---|
| 33 | // Stroke the graph
|
---|
| 34 | $g->Stroke();
|
---|
| 35 |
|
---|
| 36 | ?>
|
---|
| 37 |
|
---|