Multiple charts loading in one jsp using ajax
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Multiple charts loading in one jsp using ajax... Expand / Collapse
Author
Message
Posted 8/26/2008 1:13:17 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/1/2008 1:39:58 AM
Posts: 10, Visits: 15
hi,
here is a requirement for me
i need to load the multiple charts in a single jsp
and need to refresh every five minutes

This i am doing with ajax
can any body help on this

Thanks in advance



Regards
Ranadd
Post #8161
Posted 8/26/2008 1:20:25 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/1/2008 1:39:58 AM
Posts: 10, Visits: 15
any body reply


Regards
Ranadd
Post #8162
Posted 8/26/2008 3:54:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/31/2008 6:21:18 AM
Posts: 8, Visits: 13
Hai,
The following way you can proceed.

1. Devide your jsp page into number of iframs
2. create seperate page for each chart.
3. call all the various chart pages from various iframes of the main page.
4.Write one javascript function in the main page
  function refresh_page(){
  var url=document.getElementById('frame_left').src;
  document.getElementById('frame_left').src=url;
  var url1=document.getElementById('frame_right').src;
  document.getElementById('frame_right').src=url;
 
 }
5.Call this function withen a specific interval
 say window.setInterval("refresh_page()", 30000);


--so the frames will be refreshed withen say 30 seconds but the entire page will not refresh.

hi to all

Post #8165
Posted 8/26/2008 5:34:45 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 9/1/2008 1:39:58 AM
Posts: 10, Visits: 15
Thanks for replying


Regards
Ranadd
Post #8169
Posted 8/28/2008 6:22:56 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Today @ 1:24:22 AM
Posts: 903, Visits: 1,509
Hi,

If you intend to use AJAX then the model would be different, or if you choose you might try exploiting AJAX like feature built in FusionCharts.

This can be simply done using setDataURL() function of the charts.

1. Say you have 4 charts that you have rendered with ID's "MyChartId1", "MyChartId2","MyChartId3" and "MyChartId4". Please render the charts with register With JS option set to true/1.

2. Say you have the XML generating URL as "dataGen.jsp" and pass a querystring for each chart as "dataGen.jsp?chartType=1","dataGen.jsp?chartType=1","dataGen.jsp?chartType=2","dataGen.jsp?chartType=3" or "dataGen.jsp?chartType=4"

3. Now use this code

 window.setInterval(function(){

   for(var i=1;i<=4;++i){

      var ch=getChartFromId("MyChartId"+i);
      ch.setDataURL("dataGen.jsp?chartType="+i);

   }

}, 5000);

This would update the charts every five seconds, fetching XML from the specified URL.

No extra AJAX code required!

Regards,

Sudipto Choudhury
FusionCharts Team

Post #8241
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 4:13am


Execution: 0.078.