Single Series FusionChart XML

<?php
include_once('database.php');
include_once('mysqlimproved.php');
include_once('FusionCharts_Plugin.php');

$q = "select KdKat as kode, short as nama from g3n_kategori";
$db = new MysqlImproved_Driver;
$db->connect();
$db->prepare($q);
$db->query();
$ar = $db->datashet();

// constructor
$fc = new FusionCharts('Pie3D', 400, 300, true);
//setting path
$fc->setSWFPath('./FC/');
// setting parameter
$fc->setChartParams("caption=Factory Sales;subCaption=Year 2007;bgColor=ffccff");

// add chart data
foreach($ar as $var=>$val){
    $fc->addChartData($val['kode'], "name=".$val['nama'].";color=ff0000;link=http://www.FusionCharts.com");
}

//change header
header('Content-type: text/xml');
// make it out
print $fc->getXML();

?>

Published by

G3n1k

just to remember what i had known :)

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