Reputation: 10791
I am using fusionchartsfree to create visualization tools for my site.
I have adjusted a sample page as the code below shows. this works 100% on my xampp but when uploading (hosted on hostgator) it fails to display the graph.
Here is my code:
<?php
//We've included ../Includes/FusionCharts_Gen.php, which contains
//FusionCharts PHP Class to help us easily embed charts
//We've also used ../Includes/DBConn.php to easily connect to a database.
include("FusionCharts_Gen.php");
include("DBConn.php");
?>
<HTML>
<HEAD>
<TITLE>
Report Bar Chart
</TITLE>
<?php
//You need to include the following JS file, if you intend to embed the chart using JavaScript.
//Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer
//When you make your own charts, make sure that the path to this JS file is correct. Else, you would get JavaScript errors.
?>
<SCRIPT LANGUAGE="Javascript" SRC="FusionCharts.js"></SCRIPT>
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.text{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</HEAD>
<BODY>
report
<CENTER>
<?php
//In this example, we show how to connect FusionCharts to a database.
//For the sake of ease, we've used an MySQL databases containing two
//tables.
// Connect to the Database
$link = connectToDB();
# Create pie 3d chart object using FusionCharts PHP Class
$FC = new FusionCharts("Pie3D","650","450");
# Set Relative Path of swf file.
$FC->setSwfPath("FusionCharts/");
//Store chart attributes in a variable for ease of use
$strParam="caption=Factory Output report;subCaption=By Quantity;pieSliceDepth=30; showBorder=1;showNames=1;formatNumberScale=0;numberSuffix= Units;decimalPrecision=0";
# Set chart attributes
$FC->setChartParams($strParam);
// Fetch all factory records usins SQL Query
//Store chart data values in 'total' column/field and category names in 'FactoryName'
$strQuery = "select factory_output.FactoryID as factoryid, factory_master.FactoryName as factoryname, sum(factory_output.Quantity) as total from factory_output, factory_master where factory_output.FactoryId=factory_master.FactoryId group by factory_output.FactoryId,factory_master.FactoryName";
$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, "total", "FactoryName");
}
mysql_close($link);
# Render the chart
$FC->renderChart();
?>
</CENTER>
</BODY>
</HTML>
Please can you let me know where I am going wrong? As mentioned this works on my xampp, only username and password has changed for database however I do not get any mysql login errors so dont think it is that.
Alternatively any other easy to use graph packages out there that are classy and reliable?
Thanks, Ryan
Upvotes: 0
Views: 3316
Reputation: 12447
Check if the browser's console log shows an errors.
Either the FusionCharts.js file or the SWF file might be inaccessible.
Let us know about any errors in the console log.
Know more about debugging your charts - http://docs.fusioncharts.com/charts/contents/?Debug/Basic.html
Upvotes: 2