Let us give a brief outline of the library to be going with.
pChart is a set of classes that were designed by web developers for plotting charts, diagrams, etc. on php. For more specific information on this library you can refer to http://www.pchart.net web-site. In fact, the results achievable with the use of pChart can be striking, e.g.:
So as to insure proper functioning of the pChart you will have to to have the additional library for php installed on your server. For this, the following set of commands can be run
for Linux-systems:
sudo apt-get install php5-gd sudo /etc/init.d/apache2 restart
for Windows you will have to comment the bar in php.ini:
;extension=php_gd2.dll
After that you'll need to restart the Apache server.
The pChart library can be downloaded from here.
Now it is time to look at how the library works with with Drupal 7. There is a module (of the same name) pChart accessable on drupal.org web-site which you can make use of. As it is specified in its documentation, the only thing it does on its own is creating the basic wrapper for pChart integration with Drupal. Thus, we can easily do without it.
First, the pChart folder needs to be created in sites/all/libraries directory with all library files eventually pasted into it. After that, we will announce the page our of chart's location:
/** * Implements hook_menu(). */ function internetdevels_menu() { $items = array(); $items['pchart'] = array( 'page callback' => 'drupal_get_form', 'page arguments' => array('internetdevels_pchart_form'), 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); return $items; }