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' driver to be created by default.
Otherwise use a single parameter either as an associated array or passing the driver along to the constructor:
1) Create a new driver with the following parameters:
'driver' - The driver 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, 'driver' => 'jpg')));
Image_Graph::)
2) Use the driver specified, pass a valid Image_Graph_Driver as parameter. Remember to pass by reference, i. e. &$driver, fx.:
$Graph =& new Image_Graph(&$Driver);
or using the factory method:
$Graph =& Image_Graph::factory('graph', &$Driver));
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
'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
'ttf_font' = 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: