Image_Graph Image_Graph(
mixed
$params, [int
$height = false], [bool
$createTransparent = false])
|
|
Image_Graph [Constructor].
If passing the 3 parameters they are defined as follows:'
Fx.:
$Graph =& new Image_Graph(400, 300);
or using the factory method:
$Graph =& Image_Graph::factory('graph', array(400, 300));
This causes a 'png' canvas to be created by default.
Otherwise use a single parameter either as an associated array or passing the canvas along to the constructor:
1) Create a new canvas with the following parameters:
'canvas' - The canvas type, can be any of 'gd', 'jpg', 'png' or 'svg' (more to come) - if omitted the default is 'gd'
'width' - The width of the graph
'height' - The height of the graph
An example of this usage:
$Graph =& Image_Graph::factory('graph', arrray(array('width' => 400, 'height' => 300, 'canvas' => 'jpg')));
Image_Graph::)
2) Use the canvas specified, pass a valid Image_Canvas as parameter. Remember to pass by reference, i. e. &$canvas, fx.:
$Graph =& new Image_Graph($Canvas);
or using the factory method:
$Graph =& Image_Graph::factory('graph', $Canvas));
Parameters:
bool done(
[mixed
$param = false])
|
|
Outputs this graph using the canvas.
This causes the graph to make all elements perform their output. Their result is 'written' to the output using the canvas, which also performs the actual output, fx. it being to a file or directly to the browser (in the latter case, the canvas will also make sure the correct HTTP headers are sent, making the browser handle the output correctly, if supported by it).
Parameters are the ones supported by the canvas, common ones are:
'filename' To output to a file instead of browser
'tohtml' Return a HTML string that encompasses the current graph/canvas - this implies an implicit save using the following parameters: 'filename' The "temporary" filename of the graph, 'filepath' A path in the file system where Image_Graph can store the output (this file must be in DOCUMENT_ROOT scope), 'urlpath' The URL that the 'filepath' corresponds to (i.e. filepath + filename must be reachable from a browser using urlpath + filename)
Parameters:
object A &factory(
string
$class, [mixed
$params = null])
|
|
Factory method to create Image_Graph objects.
Used for 'lazy including', i.e. loading only what is necessary, when it is necessary. If only one parameter is required for the constructor of the class simply pass this parameter as the $params parameter, unless the parameter is an array or a reference to a value, in that case you must 'enclose' the parameter in an array. Similar if the constructor takes more than one parameter specify the parameters in an array, i.e
Image_Graph::factory('MyClass', array($param1, $param2, &$param3));
Variables that need to be passed by reference *must* have the & before the variable, i.e:
Image_Graph::factory('line', &$Dataset);
or
Image_graph::factory('bar', array(array(&$Dataset1, &$Dataset2), 'stacked'));
Class name can be either of the following:
- The 'real' Image_Graph class name, i.e. Image_Graph_Plotarea or
Image_Graph_Plot_Line
2 Short class name (leave out Image_Graph) and retain case, i.e. Plotarea, Plot_Line *not* plot_line
3 Class name 'alias', the following are supported:
'graph' = Image_Graph
'plotarea' = Image_Graph_Plotarea
'line' = Image_Graph_Plot_Line
'area' = Image_Graph_Plot_Area
'bar' = Image_Graph_Plot_Bar
'pie' = Image_Graph_Plot_Pie
'radar' = Image_Graph_Plot_Radar
'step' = Image_Graph_Plot_Step
'impulse' = Image_Graph_Plot_Impulse
'dot' or 'scatter' = Image_Graph_Plot_Dot
'smooth_line' = Image_Graph_Plot_Smoothed_Line
'smooth_area' = Image_Graph_Plot_Smoothed_Area 'dataset' = Image_Graph_Dataset_Trivial
'random' = Image_Graph_Dataset_Random
'function' = Image_Graph_Dataset_Function
'vector' = Image_Graph_Dataset_VectorFunction
'category' = Image_Graph_Axis_Category
'axis' = Image_Graph_Axis
'axis_log' = Image_Graph_Axis_Logarithmic
'title' = Image_Graph_Title
'line_grid' = Image_Graph_Grid_Lines
'bar_grid' = Image_Graph_Grid_Bars
'polar_grid' = Image_Graph_Grid_Polar
'legend' = Image_Graph_Legend
'font' = Image_Graph_Font
'ttf_font' = Image_Graph_Font
'Image_Graph_Font_TTF' = Image_Graph_Font (to maintain BC with Image_Graph_Font_TTF)
'gradient' = Image_Graph_Fill_Gradient
'icon_marker' = Image_Graph_Marker_Icon
'value_marker' = Image_Graph_Marker_Value
Overridden in child classes as:
- Image_Graph_Simple::factory()
- Factory method to create the Image_Simple_Graph object.
Parameters: