This package is intended to build charts "on the fly" from a mySQL database,it can handle currently bar, stacked bar, line and pie charts, and the presence of subcharts connect by arbitrary keys
Below you can find some example of how it works and what it can create (click on the images to enlarge):
Download it here
All the configuration that should be d one is into the includes/settings.inc.php Here there are the db connection strings, and the location for the ttf font to use, you need so the GD library of PHP and the library that allow the use of True Type Font. In the package inside the fonts directory there is a ready to use file. You should run the script/service_table.sql on your mySQL database to create the chart storage table
'Chart Types' (All can be in reversed form (y*x)):
'Create a new chart:'
- Go to "index.php" inside the installation folder and select "Create a new View"
- Select the database to wich you want to be attached
- Select the fields (possibly text) that should stay on the x axis of the chart with the "Fields Operations"-"X values"-"Insert". Adding them will remove them from the usable list to the used list on the right of the button
- Select the NUMERIC fields on the y axis the same way with the other set of buttons 5) Select the eventually present order by clause fields
- Insert the values for the where clause selecting the comparation operator and clicking "Insert" filling the rightmost field with the value to compare with until now the "Insert For Subquery" will not be used
- Give a name to the query and go for "Save query as", a confirmation will appear with the query used to insert the field
- Click confirm and show the chart with "Create Chart" to create only the image or "Create Chart Inside" to create a container indexed and mapped image
- Clicking on the labels will allow you (in case of "Create Chart Inside") to move to the corrispondinga data on the db, in case of query with more than 50 records the same act will move you on a subset of 50 elements on wich you could select another time the label and go with the data.
'Create a subquery:'
Supposed that you have to link to tables in a one-to-many relationship, and you whant to reach the "many" chart through the "one" chart, you should create a subquery we suppose the company->employees.
- Create the company chart with the required data and save
- Create the employees chart adding the where condition with the button "Insert For Subquery", this will add things in from FIELD='?'. The ? will be automatically replaced with a value passed by the company table. Of course here you can add even standard where conditions!! and save
- Coming back to the company chart we select inside teh SubQuery combo the freshly created employees chart
- We add then using Insert of Subquery Fields, the fields in the EXACT ORDER in wich the ? are inside the employee's where clause. These will be the parameter fields used to build the subquery. and save
- At this moment, when you show the chart with the "Create Chart Inside", and with less than 50 fields (so that you could se the table with all the fields), clicking on the 2nd field will carry you to the subquery into a new window!! Data Warehouse is done!! :P
The chart is obtained calling charter.php with the following parameters with the post or the url parameters:
- query_id=[A generic number]
- x_fields=[The comma separated list of field to show on x]
- y_fields=[The comma separated list of field to show on y]
- where_clause=[The where clause]
- query_name=[The name of the query a generic string]
- table_name=[The mySQL table name on wich create chart,CASE SENSITIVE]
- ordbyfields=[The order by clause]
- start_setp=[The mySQL LIMIT first parameter]
- end_step=[The mySQL LIMIT second parameter]
- ydimlabels=[The width of the labels, for bars and lines]
- ydimchart=[The width of the chart]
- reversed=[Invert xy with yx can be 1 or 0]
- chart_type=[May be stacked-bars,bars,lines,pie]
The same parameters are used to call the chart_container.php. The only needed files are strictly charter.php and the include section (with of course this readme and the license).
This is distributed with NO WARRANTY and under the terms of the GNU GPL and PHP licenses. If you use it a notice or some credit would be nice.
You can get a copy of the GNU GPL at http://www.gnu.org/copyleft/gpl.html
You can get a copy of the PHP License at http://www.php.net/license.html
You can downlod graza here
Last modified on: February 14, 2002