Welcome Guest, Not a member yet? Register   Sign In
OpenFlashChart 2 and Codeigniter
#8

[eluser]dinhtrung[/eluser]
Okay, I've got it. No need for merge all the included libraries in php-ofc-library/open-flash-chart.php. Instead, you can use it purely from your controller. For an example:
Quote:<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Devel extends Controller {
var $site = array();

function __construct() {
parent::Controller();
}

function index() {
$this->site['javascript'] = array('swfobject.js');
$this->site['jsscript'] = 'swfobject.embedSWF("'.base_url().'assets/swf/open-flash-chart.swf", "my_chart","550", "200", "9.0.0", "expressInstall.swf",{"data-file":"'.base_url().'devel/data"} );';
$this->site['main'] = '<div id="my_chart"></div>';
$this->load->view('main_template', $this->site);
}

function data(){
require_once(APPPATH.'assets/ofc/open-flash-chart.php');

$title = new title( date("D M d Y") );

$data = array(9,8,7,6,null,4,3,2,1);
$data[4] = new bar_value(5);
$data[4]->set_colour( '#ff0000' );
$data[4]->set_tooltip( 'Hello<br>#val#' );

$bar = new bar_glass();
$bar->set_values( $data );

$chart = new open_flash_chart();
$chart->set_title( $title );
$chart->add_element( $bar );

echo $chart->toString();
}
}
/* End of file : system/application/controllers/uploadtest.php */
And for the view, something like this...
Quote:&lt;html&gt;
&lt;head&gt;
&lt;?php
if (is_array($javascript)){
foreach ($javascript as $j)
echo "[removed][removed]"
}
if (isset($jsscript))
echo "[removed]\n".$jsscript."[removed]\n";
?&gt;
&lt;/head&gt;
&lt;body&gt;
<div class='wrap'>
&lt;?= $main; ?&gt;
</div>
&lt;/body&gt;
&lt;/html&gt;


Messages In This Thread
OpenFlashChart 2 and Codeigniter - by El Forum - 06-21-2009, 04:35 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 06-24-2009, 10:45 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 06-25-2009, 01:37 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 06-25-2009, 10:36 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 07-05-2009, 05:47 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 07-24-2009, 04:21 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 07-24-2009, 04:43 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 07-31-2009, 11:49 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 08-09-2009, 04:30 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 08-11-2009, 06:18 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 08-18-2009, 07:13 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 08-18-2009, 01:08 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 09-17-2009, 06:36 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 10-07-2009, 03:33 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 10-21-2009, 09:24 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 10-22-2009, 06:52 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 10-28-2009, 05:35 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 11-16-2009, 04:52 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 01-18-2010, 07:06 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 01-27-2010, 08:43 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 01-27-2010, 04:50 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-05-2010, 06:24 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-05-2010, 07:12 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-05-2010, 08:29 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-05-2010, 08:54 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-05-2010, 09:07 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-05-2010, 09:29 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-05-2010, 09:42 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-05-2010, 09:47 AM
OpenFlashChart 2 and Codeigniter - by El Forum - 05-07-2010, 04:01 PM
OpenFlashChart 2 and Codeigniter - by El Forum - 09-24-2010, 04:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB