
Untitled
By: a guest on
May 8th, 2012 | syntax:
None | size: 1.58 KB | hits: 9 | expires: Never
<?php if (! defined('BASEPATH')) exit('No direct script access');
/**
*
* @author Yorick Peterse
* @package Codeigniter Open Flash Chart
* @category Controllers
*/
class Example extends Controller
{
/**
* Called whenever the class is initialized.
*
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
$this->load->library('openflashchart');
$this->load->helper('url');
}
// -----------------------------------------------
/**
* Show a graph
*
* @access public
* @return void
*/
public function index()
{
echo $this->openflashchart->generate_flash(site_url('example/get_json'), 'ofc_object', 900, 700);
}
// -----------------------------------------------
/**
* Generate some JSON for the chart
*
* @access public
* @return void
*/
public function get_json()
{
header('Content-type: application/json');
$this->openflashchart->set_y_axis(NULL, array('max' => 50));
$this->openflashchart->set_y_legend('Number of students', '{color: #000000; font-size: 14px;}');
// Create the chart data
$this->openflashchart->new_chart('line', array(12, 14, 25), array('text' => 'Female', 'colour' => '#FF0000'));
$this->openflashchart->new_chart('line', array(10,30,20), array('text' => 'Male', 'colour' => '#000000') );
$this->openflashchart->new_chart('line ', array(0,1,42), array('text' => 'Unsure'));
echo $this->openflashchart->generate_chart('Students');
}
}
/* End of file example.php */
/* Location: ./application/controllers/example.php */