ImageGraph - General
From vtiger.com
Contents |
Includes
The following 3 lines are required at the beginning of the script
require_once('include/utils/GraphUtils.php');
include_once('Image/Graph.php');
include_once('Image/Canvas.php');
Image Graph Factory
Image Graph implement an object factory which allow manipulation of all elements of a graph by setting properties or calling methods.
Syntax is :
$obj =& Image_Graph::Factory(class_name[,param_array]);
where :
class_name is the name of the element class, ex: 'Image_Graph_Legend' or a short name like 'plotarea'. param_array is an array of parameters for the class constructor.
Embedding classes instantiation
ImageGraph factory allows embedded calls. Examples can be found using the following syntax :
$graph->add(
Image_Graph::vertical(
$title =& Image_Graph::factory('title', array('My Title',10)),
Image_Graph::vertical(
Image_Graph::horizontal(
$plotarea =& Image_Graph::factory('plotarea'),
$legend_box =& Image_Graph::factory('legend'),
80
),
$footer =& Image_Graph::factory('title', array('A Footer',8)),
90
),
5
)
);
This syntax works nice in a standalone PHP script. It does not in a Vtiger module. The correct calls are :
$title =& Image_Graph::factory('title', array('My Title',10));
$plotarea =& Image_Graph::factory('plotarea');
$legend_box =& Image_Graph::factory('legend');
$footer =& Image_Graph::factory('title', array('A Footer',8));
$graph->add(
Image_Graph::vertical(
$title,
Image_Graph::vertical(
Image_Graph::horizontal($plotarea,$legend_box,80),
$footer,
90
),
5
)
);
A detailed explanation of this graph layout can be found at ImageGraph - Graph Layout
Related links
Complete Image Graph documentation
Tons of examples and good forum, more understandable for a first approach.
Classes short names
| Short Name | Class Name |
|---|---|
| Layout | |
| graph | Image_Graph |
| plotarea | Image_Graph_Plotarea, |
| Plot types | |
| line | Image_Graph_Plot_Line |
| area | Image_Graph_Plot_Area |
| bar | Image_Graph_Plot_Bar |
| smooth_line | Image_Graph_Plot_Smoothed_Line |
| smooth_area | Image_Graph_Plot_Smoothed_Area |
| pie | Image_Graph_Plot_Pie |
| radar | Image_Graph_Plot_Radar |
| step | Image_Graph_Plot_Step |
| impulse | Image_Graph_Plot_Impulse |
| dot | Image_Graph_Plot_Dot |
| scatter | Image_Graph_Plot_Dot |
| Datasets | |
| dataset | Image_Graph_Dataset_Trivial |
| random | Image_Graph_Dataset_Random |
| function | Image_Graph_Dataset_Function |
| vector | Image_Graph_Dataset_VectorFunction |
| Axis | |
| category | Image_Graph_Axis_Category |
| axis | Image_Graph_Axis |
| axis_log | Image_Graph_Axis_Logarithmic |
| Grids | |
| line_grid | Image_Graph_Grid_Lines |
| bar_grid | Image_Graph_Grid_Bars |
| polar_grid | Image_Graph_Grid_Polar |
| icon_marker | Image_Graph_Marker_Icon |
| value_marker | Image_Graph_Marker_Value |
| Miscellaneous | |
| title | Image_Graph_Title |
| legend | Image_Graph_Legend |
| font | Image_Graph_Font |
| ttf_font | Image_Graph_Font |
| Image_Graph_Font_TTF | Image_Graph_Font |
| gradient | Image_Graph_Fill_Gradient |
