Drilldown using dataURL method doesn't display a chart
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Drilldown using dataURL method doesn't... Expand / Collapse
Author
Message
Posted 6/11/2008 9:22:22 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 6/22/2008 7:28:15 AM
Posts: 15, Visits: 29
I am trying to create a drilldown that will show the daily numbers from a 3D column chart that shows monthly totals. I'm using the dataURL method to create the 3D column chart. My chart container page is called wordform.php; my data provider page is called BuddyMonthlyData.php. I have created a second data provider page called BuddyHistoryData.php and tested to see that the sql works correctly.

I changed addDataFromDatabase in BuddyMonthly Data to this --

$FC->addDataFromDatabase($result, "total", "months","","BuddyHistoryData.php?month_name=##months##");

When I click on a column I can see the correct value for the month is being passed to the new page (it shows in the address bar) but the only thing that displays is the word Chart, centered at the top of the page. What am I doing wrong?

I've pasted BuddyHistoryData.php below.

<?php

session_start();

include("includes/WCBConn.php");

include("includes/FusionCharts_Gen.php");

 

//This page generates the XML data for the Pie Chart contained in

//Default.php.

//For the sake of ease, we've used an MySQL databases containing two

//tables..

//Connect to the Database

$link = connectToDB();

# Request the month name from QueryString, we set the MonthName in BuddyMonthlyData.php

$MonthName = $_REQUEST['month_name'];

 

# Create a column 2D chart object

$FC = new FusionCharts("Column2D","650","450");

# Set Relative Path of swf file.

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

#store chart attributes in a variable

$strParam="caption=Average and Word Count;

showBorder=1;showwritten=1;formatNumberScale=0;decimalPrecision=0;rotatenames=1;

linecolor=8F3844;outCnvBaseFontSze=12;outCnvBaseFontColor=3D515C";

#Set chart attributes

$FC->setChartParams($strParam);

// Fetch all user records using SQL Query

//Store chart data values in 'total' column/field and category names in 'written_date'

$strQuery = "select name, date_format(written_date, '%b %e')as written, words as total, written_date as sortdate

from buddies

where name = '$_SESSION[sess_name]'

and date_format(last_day(written_date),'%b')='" . $MonthName . "'

union select name, date_format(day, '%b %e') as written, words as total, day as sortdate

from wallofshame

where name = '$_SESSION[sess_name]'

and date_format(last_day(day),'%b')='" . $MonthName . "'

order by sortdate";

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

// echo "value of result is " . $result;

//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", "written");

}

mysql_close($link);

//Set Proper output content-type

// ***** if the line below is uncommented I get "Only one top level element is allowed" error *****

//header('Content-type: text/xml');

//Just write out the XML data

//NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER

// print $FC->getXML();

$FC->renderChart();

?>

--Liz

Post #6751
Posted 6/13/2008 12:52:29 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Today @ 7:54:06 AM
Posts: 644, Visits: 1,948
Hi,

Please add FusionCharts.js in your page. It will work for you. Please follow the step.

<html>
<head>
<title>FusionCharts</title>
<script language="javascript" type="text/javascript" src="your js path/FusionCharts.js"></script>
</head>
<body>
<? $FC->renderChart(); ?>
</body>
</html>

Thanks,
Arindam

FusionCharts Team
www.fusioncharts.com

Post #6823
Posted 6/13/2008 3:10:11 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 6/22/2008 7:28:15 AM
Posts: 15, Visits: 29
Thanks, Arindam, but I'm still only seeing the word Chart. If I include header('Content-type: text/xml'); in the php before the html tags it shows all of the xml data, so it's definately pulling the right stuff... just not displaying it as a graph.

- <html>
- <head>
  <title>Mothly History Data</title>
  <script language="javascript" type="text/javascript" src="../../FusionCharts/FusionCharts.js" />
  </head>
- <body>
<!--
 START Script Block for Chart Column2D14 
  -->
  <div id="Column2D14Div" align="center">Chart.</div>
- <script type="text/javascript">
  //Instantiate the Chart var chart_Column2D14 = new FusionCharts("includes/FCF_Column2D.swf", "Column2D14", "650", "450"); //Provide entire XML data using dataXML method chart_Column2D14.setDataXML("
- <graph caption="Average and Word Count" showBorder="1" showwritten="1" formatNumberScale="0" decimalPrecision="0" rotatenames="1" linecolor="8F3844" outCnvBaseFontSze="12" outCnvBaseFontColor="3D515C">
  <set value="160" name="Apr 1" color="B76677" />
  <set value="110" name="Apr 2" color="B77D66" />
  <set value="121" name="Apr 3" color="B7A666" />
  <set value="104" name="Apr 4" color="9FB766" />
  <set value="110" name="Apr 5" color="77B766" />
  <set value="135" name="Apr 6" color="66B77E" />
  <set value="108" name="Apr 7" color="66B7A6" />
  <set value="105" name="Apr 8" color="66A0B7" />
  <set value="147" name="Apr 9" color="6677B7" />
  <set value="127" name="Apr 10" color="7D66B7" />
  <set value="101" name="Apr 11" color="A666B7" />
  <set value="104" name="Apr 12" color="B7669F" />
  <set value="143" name="Apr 13" color="CCCCFF" />
  <set value="110" name="Apr 15" color="669900" />
  <set value="134" name="Apr 15" color="1941A5" />
  <set value="125" name="Apr 16" color="AFD8F8" />
  <set value="120" name="Apr 17" color="F6BD0F" />
  <set value="197" name="Apr 18" color="8BBA00" />
  <set value="157" name="Apr 19" color="A66EDD" />
  <set value="277" name="Apr 20" color="F984A1" />
  <set value="224" name="Apr 22" color="B76677" />
  <set value="107" name="Apr 23" color="B77D66" />
  <set value="137" name="Apr 24" color="B7A666" />
  <set value="110" name="Apr 25" color="9FB766" />
  <set value="0" name="Apr 26" color="77B766" />
  <set value="0" name="Apr 27" color="66B77E" />
  <set value="359" name="Apr 27" color="66B7A6" />
  <set value="284" name="Apr 28" color="66A0B7" />
  <set value="103" name="Apr 29" color="6677B7" />
  <set value="0" name="Apr 30" color="7D66B7" />
  <set value="115" name="Apr 30" color="A666B7" />
  </graph>
  ") //Finally, render the chart. chart_Column2D14.render("Column2D14Div");
  </script>
<!--
 END Script Block for Chart Column2D14 
  -->
  </body>
  </html>


--Liz
Post #6845
Posted 6/13/2008 11:58:39 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Today @ 7:54:06 AM
Posts: 644, Visits: 1,948
Hi,
Here same javascript (FusionCharts.js) path problem. First of all be sure about relative path of FusionCharts.js. and second swf file path is ok or not?. also please comment header('Content-type: text/xml'). this is for xml output only. for html output no need of that.


Thanks,
Arindam

FusionCharts Team
www.fusioncharts.com

Post #6848
Posted 6/15/2008 11:01:33 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 6/22/2008 7:28:15 AM
Posts: 15, Visits: 29
I only included the header so that I could show you that data was being returned from the sql statement. I have commented it out from the php file.

Did you mean that the html code should go at the end of my drilldown data container page? As a reminder, my chart container page is wordcount.php, the data container page is BuddyMonthlyData.php and the drilldown data container is BuddyHistoryData.php. I added it to the end of BuddyHistoryData.php

I've now given the full path to both FusionCharts.js and FCF_column2D and still all I see if the word Chart on the new page.

--Liz

Post #6861