HerbIgniter User Guide Version 1.7.2


Chart Helper

The Chart Helper file contains functions that assist in working with the bundled Flash charts. The author of HerbIgniter purchased a Developer's License, and has included it in this library under this library's license. If you want the source code and a license of your own, visit amCharts.

Loading this Helper

This helper is loaded using the following code:

$this->load->helper('chart');

The following functions are available:

pie( $settings, $labels, $slices, filename="output.xml", w=534, h=170, align="middle", bg="transparent", path=NULL, chart_title=NULL )

Deploys the amCharts Pie Chart. There are a lot of settings. Default settings are filled in if you don't set all of them.

You can read about the settings by looking at the Chart Helper file in the HerbIgniter source code.


You can also visit amCharts, but our interface doesn't follow those completely (due to the fact that we are in an array and they are in XML). You must define a writeable (chmod 777) xml dump file, which programs the actual Flash chart on the page. The path parameter sets the required path for the swf file. If it is not set, it defaults to the httproot/charts. You must also populate data via the slices parameter with a specific object (shown below, after a long list of settings). You can also program the labels parameter.

This function has a lot of settings:

Example:

$slices = array(
array( 'title'=>'Percentage of Herb Growers', 'pullout'=>true, 'value'=>17, 'url=>'http://www.potgrowersusa.com' ),
array( 'title'=>'Percentage of Herb Consumers, 'pullout'=>true, 'value'=>35, 'url=>'http://www.hightimes.com' ),
array( 'title'=>'Percentage of Herb Drinkers', 'pullout'=>true, 'value'=>70, 'url=>'http://www.moderndrunkard.com' )
);

$settings = array( 'base_color'=>'FF0000' );
$page->append_body( pie( $settings, $slices, "somewriteable.xml" ) );

function column_chart( settings, labels, guides, graphs, data, series='1',
filename="output.xml", w=534, h=170, align="middle", bg="transparent",
path=NULL, chart_title=NULL )

You can also invoke this function using the synonymous bar() function. There are a lot of settings. In fact, this is the most complex of the amCharts (except for perhaps the Stock Chart called amStock). Default settings are filled in if you don't set all of them.

You can read about all of the settings by looking at the Chart Helper file in the HerbIgniter source code.

You can also visit amCharts, but our interface doesn't follow those completely (due to the fact that we are in an array and they are in XML). You must define a writeable (chmod 777) xml dump file, which programs the actual Flash chart on the page. The path parameter sets the required path for the swf file. If it is not set, it defaults to the httproot/charts. You must also populate data via the slices parameter with a specific object (shown below, after a long list of settings). You can also program the labels parameter.

Usage example:

$slices = array(
array( 'title'=>'Percentage of Herb Growers', 'pullout'=>true, 'value'=>17, 'url=>'http://www.potgrowersusa.com' ),
array( 'title'=>'Percentage of Herb Consumers, 'pullout'=>true, 'value'=>35, 'url=>'http://www.hightimes.com' ),
array( 'title'=>'Percentage of Herb Drinkers', 'pullout'=>true, 'value'=>70, 'url=>'http://www.moderndrunkard.com' )
);

$settings = array( 'base_color'=>'FF0000' );
$page->append_body( bar( $settings, $slices, "somewriteable.xml" ) );