CLASS CanvasGraph EXTENDS Graph
(Defined in: jpgraph_canvas.php : 21)
 CanvasGraph  Graph 
 CanvasGraph() 
 InitFrame() 
 Stroke() 
 Add() 
 AddBand() 
 AddLine() 
 AddText() 
 AddY() 
 AddY2() 
 AdjBackgroundImage() 
 AdjImage() 
 CheckCSIMCache() 
 GetHTMLImageMap() 
 Graph() 
 Set3DPerspective() 
 Set90AndMargin() 
 SetAlphaBlending() 
 SetAngle() 
 SetAxisLabelBackground() 
 SetAxisStyle() 
 SetBackgroundCFlag() 
 SetBackgroundCountryFlag() 
 SetBackgroundGradient() 
 SetBackgroundImage() 
 SetBackgroundImageMix() 
 SetBox() 
 SetClipping() 
 SetColor() 
 SetFrame() 
 SetFrameBevel() 
 SetGridDepth() 
 SetIconDepth() 
 SetImgFormat() 
 SetMargin() 
 SetMarginColor() 
 SetScale() 
 SetShadow() 
 SetTextScaleAbsCenterOff() 
 SetTickDensity() 
 SetTitleBackground() 
 SetTitleBackgroundFillStyle() 
 SetY2OrderBack() 
 SetY2Scale() 
 SetYDeltaDist() 
 SetYScale() 
Stroke() 
 StrokeCSIM() 
 StrokeFrameBackground() 
 

Class usage and Overview
If you for some reason just want plain canvas to draw on using the direct drawing method you can create a new canvas with this class.

The canvas is meant to be manipulated through the Image class which can be found as an instance variable ($graph->img) in the canvas class.

Please remeber taht using the drawing methods in the Image class assumes screen (pixels) coordinates.

 

See also related classes:
Graph

 


Class Methods

 

 

function CanvasGraph($aWidth,$aHeight,$aCachedName,$timeout,$inline)
Construct a new Cnavas graph

ArgumentDefaultDescription
$aWidth 300 Width of graph
$aHeight 200 Height of graph
$aCachedName "" Cache file name
$timeout 0 Cache timeout
$inline 1 Inline or not

Description
See Graph::Graph() for description, this method is identical. 
 
See also
Graph::Graph

Example

// Create a new canvas and draw a line from top left to
// bottom right
$canvas = new CanvasGraph(300,200);
$canvas->img->SetColor('black*);
$canvas->img->Line(0,0,300,200);
$canvas->Stroke();

 

 

function InitFrame()
Strokes plot area and margin


Description
Calling this method will fill the margin (with the margin color) and fill the plot area with the plot color. You should call this method before stroking anything else to the canvas as otherwise what you have stroken will be overwritten. 

Example

// Setup a basic canvas we can work 
$g = new CanvasGraph(400,200,'auto');
$g->SetMargin(5,11,6,11);
$g->SetShadow();
$g->SetMarginColor("teal");

// We need to stroke the plotarea and margin before we add the
// text since we otherwise would overwrite the text.
$g->InitFrame();

// Draw a text box in the middle
$txt="This\nis\na TEXT!!!";
$t = new Text($txt,200,10);
$t->SetFont(FF_ARIAL,FS_BOLD,40);

// Stroke the text
$t->Stroke($g->img);

// Stroke the graph
$g->Stroke();

 

 

function Stroke($aStrokeFileName)
Stroke graph to browser or file

ArgumentDefaultDescription
$aStrokeFileName "" Filename to stroke to

Description
Stroke a file to browser or file. See Graph::Stroke() for more details. 
 
See also
Graph::Stroke

Example

$canvas->Stroke();