If your web applications require dynamically created charts or graphs, then this library may just be what you need.
In the spirit of CodeIgniter, the library is open source, small, (20KB) efficient and Object-oriented.
It will run on either PHP 4 or 5, with no changes to core CI code.
The Panachart library is written by Eugen Fernea and is licensed under the GPL.
Modifications to provide the code as a Code Igniter library by Oscar Bajner.
PHP version 4 or 5.
CodeIgniter framework version 1.4.0 or higher.
GD graphics library version 2.
Bandwidth friendly, the average image size for a 450*250 image is around 2K
Can output to a file or directly to an HTTP stream
Supports several plot types: bars, lines, dots, areas, step, impuls
Supports multiple series plots on the same image
Supports automatic scaling of plot area by axis labels size
More advanced plots will be supported in future versions.
Download the library: Panaci.zip
Example usage: In your controller constructor,
$params = array('width' => 450, 'height' => 250, 'margin' => 15, 'backgroundColor' => '#eeeeee'); $this->load->library('chart', $params);
In your controller functions,
$data_2001 = array(43,163,56,21,0,22,0,5,73,152,123,294);
$data_2002 = array(134,101,26,46,22,64,0,28,8,0,50,50);
$Labels = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
$this->chart->setLegend(SOLID, "#444444", "#ffffff", 2);
$this->chart->addSeries($data_2001,'dot','2001 ', SOLID,'#00ff00', '#00ff00');
$this->chart->addSeries($data_2002,'area','2002 ', SOLID,'#ff0000', '#00ffff');
$this->chart->setXAxis('#000000', SOLID, 1, "2001");
$this->chart->setYAxis('#000000', SOLID, 2, "Rainfall in MM");
$this->chart->setLabels($Labels, '#000000', 1, HORIZONTAL);
$this->chart->setGrid("#bbbbbb", DASHED, "#bbbbbb", DOTTED);
Will produce the chart below:
Documentation on this page
Page rendered in 0.0041 seconds