Subversion Repositories Sites.tela-botanica.org

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 david 1
<?php
2
/*=======================================================================
3
// File: 	JPGRAPH_CANVAS.PHP
4
// Description:	Canvas drawing extension for JpGraph
5
// Created: 	2001-01-08
6
// Author:	Johan Persson (johanp@aditus.nu)
7
// Ver:		$Id: jpgraph_canvas.php,v 1.1 2004/06/15 10:13:19 jpm Exp $
8
//
9
// License:	This code is released under QPL
10
// Copyright (C) 2001,2002 Johan Persson
11
//========================================================================
12
*/
13
 
14
//===================================================
15
// CLASS CanvasGraph
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 {
23
//---------------
24
// CONSTRUCTOR
25
    function CanvasGraph($aWidth=300,$aHeight=200,$aCachedName="",$timeout=0,$inline=1) {
26
	$this->Graph($aWidth,$aHeight,$aCachedName,$timeout,$inline);
27
    }
28
 
29
//---------------
30
// PUBLIC METHODS
31
 
32
    function InitFrame() {
33
	$this->StrokePlotArea();
34
    }
35
 
36
    // Method description
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);
41
	    }
42
	}
43
	$this->StrokeTitles();
44
 
45
	// If the filename is given as the special _IMG_HANDLER
46
	// then the image handler is returned and the image is NOT
47
	// streamed back
48
	if( $aStrokeFileName == _IMG_HANDLER ) {
49
	    return $this->img->img;
50
	}
51
	else {
52
	    // Finally stream the generated picture
53
		$this->cache->PutAndStream($this->img,$this->cache_name,$this->inline,
54
					   $aStrokeFileName);
55
	}
56
    }
57
} // Class
58
/* EOF */
59
?>