Sign in to follow this  
fcuser

Multiple charts in a page problem

Recommended Posts

Hi

I am trying the following piece of code to generate multiple charts in html in one page.

<html>
<head>
<script language="JavaScript" src="../FusionCharts/FusionCharts.js"></script>
</head>
<body bgcolor="#ffffff">
<div id="chart1div" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
<script type="text/javascript">
  var myChart1 = new FusionCharts("../FusionCharts/Pie3D.swf", "myChart1Id", "900", "300", "0", "0");
  myChart1.setDataURL("Data.xml");
  myChart1.render("chart1div");
</script>
<div id="chart2div" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
<script type="text/javascript">
  var myChart2 = new FusionCharts("../FusionCharts/Column2D.swf", "myChart1Id", "600", "300", "0", "0");
  myChart2.setDataURL("Data.xml");
  myChart2.render("chart2div");
</script>
</body>
</html>

 I am unable to see the charts. I am not sure what the mistake is. Can you please tell me where I went wrong? Thanks in advance.

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

 

 

 

For each chart you have to pass unique IDs.

 

 

 

Thus,

 

var myChart2 = new FusionCharts("../FusionCharts/Column2D.swf", "myChart1Id", "600", "300", "0", "0");

 

would be,

 

var myChart2 = new FusionCharts("../FusionCharts/Column2D.swf", "myChart2Id", "600", "300", "0", "0");

 

 

 

You had specified the same ID myChart1Id for both the charts. That is why the charts were not showing.

 

 

 

Hope this helps.:)

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

You are most welcome.

Its great to know that the charts are being displayed. :)

Happy FusionCharting. :)

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