Sign in to follow this  
dakmatt

Newbies: Selectscatter From Mysql

Recommended Posts

Hi,

 

How to display chart using 'SelectScatter.swf' from MySQL?

 

Below,are my codes,but its' not working. Please help.

 

<?php

$link = connectToDB('"db1');

# Create object for Column 3D chart

$FC = new FusionCharts("SelectScatter","550","400");

 

# Setting Relative Path of chart swf file.

$FC->setSwfPath("FusionCharts/");

 

# Define chart attributes

$strParam="caption=SelectScatter;xAxisName=Column2;yAxisName=Column1";

 

# Set chart attributes

$FC->setChartParams($strParam);

$strQuery = "select col1,col2 from table1";

$result = mysql_query($strQuery) or die(mysql_error());

 

//Pass the SQL Query result to the FusionCharts PHP Class function

//along with field/column names that are storing chart values and corresponding category names

//to set chart data from database

if ($result)

{

$FC->addDataFromDatabase($result, "col2", "col1","","");

}

#mysql_close($link);

# Render the chart

$FC->renderChart();

?>

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
Sign in to follow this