unciebuck

Set Value Variable In Fusion Charts

Recommended Posts

I have a database that adds up all the various categories

 

How do I put the values in the set values ie. it counts the religions... so I want to put in $buddhist $hindus etc... I know the it adds up ok, its putting the variables into the dataxml set name value bit that it only accepts whole numbers

 

The graphs look great tho...

 

 

<html>

<head>

<title>test3</title>

<?php $con = mysql_connect("blahblahblah", "blahblahblah", "blahblahblah") or die(mysql_error());

mysql_select_db("blahblahblah ");

if (!$con)

{

die('Could not connect: ' . mysql_error());

}

mysql_select_db("my_db", $con);

$number=0;

$buddhist=0;

$christian=0;

$hindu=0;

$jewish=0;

$muslim=0;

$sikh=0;

$other=0;

$prefer=0;

$result = mysql_query("SELECT * FROM diverse");

while($row = mysql_fetch_array($result))

{

if (($row['greligion']) == "Buddhist") {$buddhist = $buddhist + 1;}

if (($row['greligion']) == "Christian") {$christian=$christian+1;}

if (($row['greligion']) == "Hindu") {$hindu=$hindu+1;}

if (($row['greligion']) == "Jewish") {$jewish=$jewish+1;}

if (($row['greligion']) == "Muslim") {$muslim=$muslim+1;}

if (($row['greligion']) == "Sikh") {$sikh=$sikh+1;}

if (($row['greligion']) == "other") {$other=$other+1;}

if (($row['greligion']) == "prefer") {$prefer=$prefer+1;}

}

mysql_close($con);

echo "</table>";

?>

</head>

<html>

<body bgcolor="#ffffff">

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="600" height="500" id="Column3D" >

<param name="movie" value="http://www.clcuk.co.cc/charts/Charts/FCF_Column3D.swf?chartWidth=600&chartHeight=500" />

<param name="FlashVars" value="&dataXML=<graph caption='Diversity - Religion' xAxisName='Religion' yAxisName='No' showNames='1' decimalPrecision='0' formatNumberScale='0'><set name='Buddhist' value='$buddhist' color='AFD8F8' /><set name='Christian' value='857' color='F6BD0F' /><set name='Hindu' value='671' color='8BBA00' /><set name='Jewish' value='494' color='FF8E46'/><set name='Muslim' value='761' color='008E8E'/><set name='Sikh' value='960' color='D64646'/><set name='Other' value='629' color='8E468E'/><set name='Prefer' value='622' color='588526'/></graph>">

<param name="quality" value="high" />

<embed src="http://www.clcuk.co.cc/charts/Charts/FCF_Column3D.swf?chartWidth=600&chartHeight=500" flashVars="&dataXML=<graph caption='Diversity - Religion' xAxisName='Religion' yAxisName='No' showNames='1' decimalPrecision='0' formatNumberScale='0'><set name='Buddhist' value='$buddhist' color='AFD8F8' /><set name='Christian' value='857' color='F6BD0F' /><set name='Hindu' value='671' color='8BBA00' /><set name='Jewish' value='494' color='FF8E46'/><set name='Muslim' value='761' color='008E8E'/><set name='Sikh' value='960' color='D64646'/><set name='Other' value='629' color='8E468E'/><set name='Prefer' value='622' color='588526'/></graph>" quality="high" width="600" height="500" name="Column3D" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

</object>

<

</body>

</html>

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Welcome to FusionCharts Forum! smile.gif

 

Please note that FusionCharts accepts data in XML/JSON format only. All you would need to do is to build proper XML from the database that you query from your database.

 

You would need to write your own code in order to suffice your requirement, as FusionCharts supports only numbers in value attribute inside the <set> element , as of now.

 

Hope this helps.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now