2 /*=======================================================================
3 // File: JPGRAPH_CANVAS.PHP
4 // Description: Canvas drawing extension for JpGraph
6 // Author: Johan Persson (johanp@aditus.nu)
7 // Ver: $Id: jpgraph_canvas.php,v 1.12 2003/01/09 12:56:56 aditus Exp $
9 // License: This code is released under QPL
10 // Copyright (C) 2001,2002 Johan Persson
11 //========================================================================
14 //===================================================
16 // Description: Creates a simple canvas graph which
17 // might be used together with the basic Image drawing
18 // primitives. Useful to auickoly produce some arbitrary
19 // graphic which benefits from all the functionality in the
20 // graph liek caching for example.
21 //===================================================
22 class CanvasGraph extends Graph {
25 function CanvasGraph($aWidth=300,$aHeight=200,$aCachedName="",$timeout=0,$inline=1) {
26 $this->Graph($aWidth,$aHeight,$aCachedName,$timeout,$inline);
32 function InitFrame() {
33 $this->StrokePlotArea();
37 function Stroke($aStrokeFileName="") {
38 if( $this->texts != null ) {
39 for($i=0; $i<count($this->texts); ++$i) {
40 $this->texts[$i]->Stroke($this->img);
43 $this->StrokeTitles();
45 // If the filename is given as the special _IMG_HANDLER
46 // then the image handler is returned and the image is NOT
48 if( $aStrokeFileName == _IMG_HANDLER ) {
49 return $this->img->img;
52 // Finally stream the generated picture
53 $this->cache->PutAndStream($this->img,$this->cache_name,$this->inline,