Load FusionChart Free Graphic on Codeigniter-Part -1

yup, i’m back with codeigniter 2.0.2 after long time ago without codeigniter in my hand. the first learning about that i got confused several file lost(i think) but after learn it. i know that same as with codeigniter last. ok now i want to show for you how to load fusionchart free on ci. move on :
1. download fusionchart(search on google).
2. download codeigniter…:D
3. after download fusionchart extract that and copy all (‘\Charts’) to your folder on ci that example (server\htdocs\YOUR_PROJECT\SUB_FOLDER_YOUR_PROJECT_ON_ROOT\Charts
4. copy js fusionchart on (FusionCharts.js) to js folder on ci.
5. Controller :

class Site extends CI_Controller{

	function __construct()
		$this->swfCharts  = base_url().'assets/FusionCharts/' ;

	function members_area()
	$data['title'] = '';
  	$FC = new FusionCharts("Column3D","280","250");

  	$strParam="caption=Mingguan Pembelian;xAxisName=Week;yAxisName=Revenue;numberPrefix=Rp;decimalPrecision=0;formatNumberScale=1";

  	$FC->addChartData("40800","name=Week 1");
  	$FC->addChartData("31400","name=Week 2");
  	$FC->addChartData("26700","name=Week 3");
  	$FC->addChartData("54400","name=Week 4");
  	$data['chart'] = $FC;

  	$FC2 = new FusionCharts("MSColumn3D","280","250");

  	$strParam2="caption=Weekly Sales;subcaption=Comparison;xAxisName=Week;yAxisName=Revenue;numberPrefix=Rp;decimalPrecision=0";


  	$FC2->addCategory("Week 1");
  	$FC2->addCategory("Week 2");
  	$FC2->addCategory("Week 3");
  	$FC2->addCategory("Week 4");

  	$FC2->addDataset("This Month");

  	$FC2->addDataset("Previous Month");
  	$data['chart2'] = $FC2;
	$data['produk1'] = $this->Model1->getproduk1();
	$data['userr'] = $this->Model1->getuser();

6. Lalu di sisi View

<script type="text/javascript" src="<?php echo base_url();?>assets/js/FusionCharts.js"></script>

ok that the simple to call fusionchart in codeigniter 2.0.2..to be continued with chart and connect to database


4 thoughts on “Load FusionChart Free Graphic on Codeigniter-Part -1

  1. You need to provide more info on things like youer helper file, In your assets you said copy over Charts but you are referencing FusionCharts did you rename or is that different please be a little more specefic

    • i can’t rename file helper, that fusionchart_gen another file on include after you download fusionchart and ekstrak all you can find it. sorry if you not understand with my article..:D

  2. please you said copy all files in /chats, but in controller you use :
    $this->swfCharts = base_url().’assets/FusionCharts/’ ;
    the functioncharts.php in chart how i use it fromhelper?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s