ethnocide

GRAPH DOESN'T APPEAR IN THE PAGE

Recommended Posts

line graph doesn't appear in the page. the only thing that appears in the page instead of the line graph is a text "Chart.". i cant figure out what is wrong with my code..

 

 

 


include("../Includes/FusionCharts.php");

include("../Includes/DBConn.php");



$patientID = $_GET['patientID'];

$strXML = "";



$get_das = mysql_query("SELECT DISTINCT DASSCORE, CONSULTDATE FROM CONSULTATION WHERE PATIENTID='$patientID' ORDER BY CONSULTDATE ASC");

	  $index = 0;

	  if(mysql_num_rows($get_das) == 0){

	  	 echo "asa";

	  }

	  else{

	  	while($get_result = mysql_fetch_array($get_das, MYSQL_NUM))

			{

			$das_index[$index] = $get_result[0];

			$date[$index] = $get_result[1];

			$strXML .= "";



                               $index++;

			}

		}



$strXML .= "";



echo renderChart("../FusionCharts/FCF_Line.swf", "", $strXML, "", 600, 300);



 

 

 

please help me with these. thanks.

Share this post


Link to post
Share on other sites

Hi,

You need to provide an id to the chart:

echo renderChart("../FusionCharts/FCF_Line.swf", "", $strXML, "ChartID1", 600, 300,false,false);

Also did you include the FusionCharts.js file?

<SCRIPT LANGUAGE="Javascript" SRC="../FusionCharts/FusionCharts.js"></SCRIPT>

If not you can try using renderChartHTML once :

echo renderChartHTML("../FusionCharts/FCF_Line.swf", "", $strXML, "ChartID1", 600, 300,false);

Share this post


Link to post
Share on other sites

Hello Sudipto,

 

 

 

I was having the same problem as outlined in this thread and when I stumbled across this post I changed renderChart to renderChartHTML and it started working (well almost, invalid XML now but thats for another thread I guess) .. so that is good. Could you please explain the differences between renderChart and renderChartHTML please?

 

 

 

Many thanks

Edited by Guest

Share this post


Link to post
Share on other sites

hi,

1. RenderChartHTML is a basic function which adds a chart to a page using HTHML embedding method. This means the method will generate an HTML string that will contain help loading the chart. This is dones using <object>/<embed> elements. The returned strin might have similar structure.: (Injecting direct HTML to a page)

 

<object ......>

  <param name='movie' value='chart.swf'>

  <param name='...' value='...'>

...

<embed src='chart.swf' .....></object>

** RenderChartHTML eariler did not supprort RegisterWithJS fucntionality of the charts. The new version of the ASP.NET 20. method found in InfoSoftGLobal.FusionCharts class has made this available.

2.Whereas  RenderChart uses JavaScript embedding method. (This method is used to override the IE - "Click Here to Activate.." ). It creates a DIV and a some lines of JavaScript codes that creats a FusionCharts JavaScript Object.Using this object the charts is rendered inside the DIV. So this is path HTML and path JavaSCript injecting. The JavaScript will handle the injecting of the <object>/<embed> tages for the charts.

This method will render string close to this :

<div id="name_div" >THIS TEXT WILL BE REPLACED BY THE CHART</div>

<script type="text/javascipt" lanuage="javascript">

var chrt_name=new FusionChrts("chart.SWG","name_id","......);

if( strURL==true){

  chrt_name.setDataURL(URL);

}else{

  chrt_name.setDataXML(strXML);

}

chrt_name.render("name_div");

 

</script>

**** You need to add/include FusionCharts.js file (to <head> ) in HTML page.Otherwise the chart will not render.

[ Note that when you add a inject a javascript using another javascript, the injected javascript will not be executed. Hence we recommend not to use RenderChart in AJAX callback, since AJAX is JavaScript and this javascript wont execute the javascript injected by RenderChart() (Untill and unless you write code to extract out all JavaSctipt code and eval() them).

Share this post


Link to post
Share on other sites

I just discovered that FusionCharts seems to choke and output "Chart" if the string passed to renderChart (but not to renderChartHTML) contains newlines (the character, in particular).

Share this post


Link to post
Share on other sites

Hi,

This may happen due to either of the 2 reasons.

1. You are not using FusionCharts.js or its not loaded : RenderChart() requires FusionCharts.js to be included in the page. Could you please try adding this to your Application Page using <script> tag?

2. You might be using ASP.NET.AJAX or some Tool of of ASP.NET.AJAX where this texts comes if you use RenderChart() method. For AJAX you should be using RenderChartHTML().

Edited by Guest

Share this post


Link to post
Share on other sites

Ahem, no. The file FusionCharts.js was there, and it was loaded as soon as I removed the newlines from the code. And this was straight PHP code, no AJAX involved. For the record, this is Windows XP SP2, Apache 2.2, PHP 5.2.5, the error visible on both Firefox 2.0.0.12 and IE 7.

Share this post


Link to post
Share on other sites

Hi,

Well yes,

New line characters would terminate the string in JavaScript. RenderChart() uses JavaScript to render charts. The whole XML is passed as a string. If you pass DataXML with newline characters in PHP that would mean a termination in stirng. Your error console in Firefox would surely show this. This would stop the execution and hence the chart wont be rendered. Rather the chart container DIV with text "Chart" remains.

Share this post


Link to post
Share on other sites

This is exactly what happens. Could you make a note on the manual about it? I came across the problem because I had indented the string in PHP to make options more readable...

Share this post


Link to post
Share on other sites

Hi. I also get just 'Chart.' showing.

 

 

 

I have included the FusionCharts.js in the header and FusionCharts.php above the header.

 

 

 

attached is the section of code in the page source created by visiting the URL.

 

 

 

(had to attach it as this forum executes the code and outputs - guess what... - "Chart.")

 

 

 

As you can see my data is being created, but the chart just will not render.

 

 

 

Any help appreciated.

code.txt

Edited by Guest

Share this post


Link to post
Share on other sites

Also, here is my code for data and rendering

 

I have also attached my header file where i have placed the includes (note that the header file is called from the man script)

 

 

 

Been all day and night on this one! still cant get the charts to render in this script (i can using a simple page structure, but that is no good to me because i want to inclde the charts in my wordpress blog)

fullcode.txt

header.txt

Share this post


Link to post
Share on other sites

i believe i am - as i mentioned i can get teh chart to work ok if i do not use a wordpress page.

 

 

 

What i have done is created a template page that i can assign in wordpress. On this template page i want to include the fusion charts charts. If i try to create the charts in the template they do not work. If I just use a standard page structure it works fine.

 

 

 

How can i get this to work in my template? It should not really make a difference but after 12 hours straight at trying to fix it i gave up.

Share this post


Link to post
Share on other sites

Hi,

Could you please attache here a screenshot of the screen that's being shown?

In any case if you let us the live wordpress URL where you are implementing this we would try debugging this live.

If you are getting a blank space in the place of the chart (while using renderChartHTML)_could you please try right clicking on that sapce to find if its showing "Movie Not Loaded"? If so its surely that the movie could not be loaded due to some path issue ro security issue in WordPress.

Share this post


Link to post
Share on other sites

Hi thanks for quick reply.

 

 

 

Indeed, i did get to teh point where by right clicking i could see "Movie not loaded in greyed" out text with another link to Flash 9

 

 

 

I suspect it is not a path issue, becuase i can get this to work on a standard page using teh same paths... agree?

 

 

 

If so, must be the wordpress security issue you mention... any ides on what thismight be??

 

 

 

Thanks

Share this post


Link to post
Share on other sites

the address should have been

 

 

 

http://www.theneuralinvestor.com/system.php

 

 

 

I have found a way to do this in wordpress. I have used the wordpress get_header, get_footer, get_sidebar functions to keep the same theme, but accessed them on a page not creadted in wordpress by adding the following php code

 

 

 


require('wp-blog-header.php');

 

 

 

instead of making a template.

 

 

 

The code now runs to create the chart, so it had something to do with WP templates.

 

 

 

Now that this is working (as you can see from the link), it is an amazing product!

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