TheWitness

Javascript Errors Rendering Charts

Recommended Posts

Hello Forum Gods and Goddesses,

 

I have an issue. I just updated my FusionCharts.js to the latest version and now for some reason I am getting all sorts of errors. Here they are:

 

#05102109  chartContainerportlet_6_1_5.render() Error >> A duplicate object  already exists with the specific Id: chartContainerportlet_6_1_5
FusionCharts.js (line 15)

 

The output is courtesy FireBug. With the old code, I never received these errors. Here is the code snippet from my app:

 

	<script type="text/javascript">
if ($.browser.msie) {
   	var D = (document.body.clientWidth)? document.body: document.documentElement;
   	var fw  = D.clientWidth;
}else{
   	var fw=window.innerWidth;
}
fw = fw * <?php print $percent;?>;
fh = 200;

var chart1 = new FusionCharts("./FusionCharts/Pie3D.swf", "<?php print "chartContainer" . $pieid;?>", fw, fh);
chart1.setDataURL("<?php print urlencode("farmmon.php?action=getchartdata&type=pie&area=" . $graph_area . "&resource_type=" . $resource_type_id . "&id=" . $pieid);?>");
chart1.render("<?php print "chartContainer" . $pieid;?>");
</script>

 

Again, this was not happening before. Please note (PHP+Js), pretty normal. For some reason, I think it's attempting to create a nested object with the same ID. I have jQueryUI sorter installed, and when I reposition the broken element, it renders right away.

 

TheWitness

www.cacti.net

Share this post


Link to post
Share on other sites

I'll take that back. When I set:

 

FusionCharts.setCurrentRenderer('javascript');[/b]

 

The whole thing breaks again.

 

Node was not found"  code: "8

 

The HighCharts are not too nice compared to flash...

 

TheWitness

Share this post


Link to post
Share on other sites

Hi there,

 

Give it another shot by using the latest FusionCharts JS supplied with the PowerCharts pack (www.fusioncharts.com/powercharts).

Just replace your existing FusionCharts JS with all JS supplied within the Charts and JSClass floder of PowerCharts.

 

Lemme know what happens.

Share this post


Link to post
Share on other sites

I'll give that a whirl and let you know. I'm just going to use the PowerCharts 3.2, as I don't know who at our company registered our Enterprise package. So, I don't currently have a login.

 

TheWitness

Share this post


Link to post
Share on other sites

Just confirming, this is what I have...

 

/*!

* FusionCharts JavaScript Library

* Copyright FusionCharts Technologies LLP

* License Information at <http://www.fusioncharts.com/license>

*

* @author FusionCharts Technologies LLP

* @version fusioncharts/3.2.1.release.2157

*

* Third-party attributions:

* SWFObject v2.2 <http://code.google.com/p/swfobject/>

* JSON v2 <http://www.JSON.org/js.html>

* Firebug Lite 1.3.0 <http://getfirebug.com/firebuglite>

* jQuery 1.4.2 <http://jquery.com/>

*/

 

 

TheWitness

Share this post


Link to post
Share on other sites

No joy...

 

#05102109  chartContainerportlet_6_1_5.render() Error >> A duplicate object  already exists with the specific Id: chartContainerportlet_6_1_5
#05102109  chartContainerportlet_7_3_10.render() Error >> A duplicate object  already exists with the specific Id: chartContainerportlet_7_3_10

Edited by TheWitness

Share this post


Link to post
Share on other sites

If I move the object on the page, I now get a different error.

 

#06091847  chartobject-1 Warning >> A FusionChart oject with the specified  id "chartContainerportlet_7_3_10" already exists. Renaming it to  chartobject-1

 

So, that much is better. I'm wondering what is going wrong and if it's a method issues. Here is the process I use when I build the page.

 

1) Create empty <div> for each chart object. Generate a uniqueue ID for that div.

2) Register the javascript for the chart object including the call back and rendering code. Do this as part or not a part of $().ready() {});

3) Error's appear for whatever reason indicating the id is already in use.

 

TheWitness

Share this post


Link to post
Share on other sites

Hi,

 

Will it be possible for you to add a single line of JavaScript code before you initialize the chart?

 

 

The line is :

if (FusionCharts && FusionCharts("<?php print "chartContainer" . $pieid;?>")) FusionCharts("<?php print "chartContainer" . $pieid;?>").dispose();

 

Put rest of the lines as you are doing:

 

var chart1 = new FusionCharts("./FusionCharts/Pie3D.swf", "<?php print "chartContainer" . $pieid;?>", fw, fh);
       chart1.setDataURL("<?php print urlencode("farmmon.php?action=getchartdata&type=pie&area=" . $graph_area . "&resource_type=" . $resource_type_id . "&id=" . $pieid);?>");
       chart1.render("<?php print "chartContainer" . $pieid;?>");

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