Code: How to user the Ajax in javascript to get the chart
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Code: How to user the Ajax in javascript to... Expand / Collapse
Author
Message
Posted 11/2/2007 7:10:51 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 12/12/2007 5:13:08 AM
Posts: 2, Visits: 8
Hi friends,

I have code to get the flash chart in javascript, like below

<script  LANGUAGE="Javascript" SRC="http://www.fusioncharts.com/Demos/Blueprint/FusionCharts/FusionCharts.js"></script>

function regfun(){

   var chart_SalesByYear = new FusionCharts("http://www.fusioncharts.com/Demos/Blueprint/FusionCharts/MSColumn3DLineDY.swf", "SalesByYear", "450", "325", "0", "1");
   chart_SalesByYear.setDataXML("<chart caption='Fraud Comparative Report' XAxisName='Monthly' palette='2' animation='1' subcaption='' formatNumberScale='0' numberPrefix='$' showValues='0' seriesNameInToolTip='0'><categories><category label='Mar 2007'/><category label='Apl 2007'/><category label='May 2007'/><category label='Jun 2007'/><category label='Jul 2007'/><category label='Aug 2007'/></categories><dataset seriesname='Billed Business'><set value='119702' link='javaScript%3AupdateCharts%281994%29%3B'/><set value='329702' link='javaScript%3AupdateCharts%211994%29%3B'/><set value='219702' link='javaScript%3AupdateCharts%281994%29%3B'/><set value='219702' link='javaScript%3AupdateCharts%281994%29%3B'/><set value='682796' link='javaScript%3AupdateCharts%281995%29%3B'/><set value='547248' link='javaScript%3AupdateCharts%281996%29%3B'/></dataset><dataset seriesName='Total Fraud' parentYAxis='S'><set value='3381'/><set value='4381'/><set value='5381'/><set value='7381'/><set value='25007'/><set value='18929'/></dataset><styles><definition><style type='font' color='666666' name='CaptionFont' size='15' /><style type='font' name='SubCaptionFont' bold='0' /></definition><application><apply toObject='caption' styles='CaptionFont' /><apply toObject='SubCaption' styles='SubCaptionFont' /></application></styles></chart>");
   chart_SalesByYear.render("urlContent");  

}

Please make this as ajax, I want to use the callback mechanism.

Thanks in advance....

Post #2947
Posted 11/2/2007 8:23:31 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Yesterday @ 2:56:41 AM
Posts: 704, Visits: 1,139
hi

you can use  chart_SalesByYear.setDataURL("ajaxServerScript.asp");//or php, or any server side script that return proper chart XML will do the same ajax effect without writing a single line of code of call back in javaScript.

Otherwise you can write normal AJAX codes. You can have a look at the ajax sample here :

http://www.fusioncharts.com/forum/Topic2576-28-1.aspx

Regards,

Sudipto Choudhury
FusionCharts Team

Post #2951
Posted 11/4/2007 3:25:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 12/12/2007 5:13:08 AM
Posts: 2, Visits: 8
Hi Sudipto,

       Could you more elaborate the things, Because I am using Servlet in the server side. I have downloaded .js and .swf files in to my server. Now I am able to create charts through javascript.

Question:  I wanted to create a servlet in the server side such a way that It should return  Fusionchart as a html script to the browser (as you said). Then I can able to show the chart with responseText in Ajax. Could you send me the servlet code.

Thanks in advance....

Post #2965
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 7:51pm


Execution: 0.141.