Hi,
The code is:
javascript
var chart1 = new FusionCharts("${externalURL}flash/fusion/Line.swf", "1", "130", "70", "0", "1");
var chart2 = new FusionCharts("${externalURL}flash/fusion/Line.swf", "2", "130", "70", "0", "1");
function submitChart(chartNum,d1,d2)
{
url="/REGION/fusionchartxml.html?";
url = url+"chartID="+chartNum+"&tn=1&d1="+d1+"&d2="+d2;
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.responseText!= null & xmlHttp.responseText!= ' '){
var xml=xmlHttp.responseText.replace(/'/g,'%26apos;');xml=xml.replace(/"/g,"'");
if(chartNum ==1 ){
var chartObj = getChartFromId("1");
chartObj.setDataXML(xml);
chartObj.render("chartdiv1");
}else{
var chartObj = getChartFromId("2");
chartOb.setDataXML(xml;
chartOb.render("chartdiv2");
}
}
}
}
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
jsp
div id="chartdiv1" align="center">The chart will appear within this DIV. This text will be replaced by the chart.
script>
<%urlEncodedURL = "/REGION/fusionchartxml.html?" + URLEncoder.encode("chartID=0&tn=1&d1="+endDate+"&d2="+selectedDate, "UTF-8");
%>
chart1.setDataURL("<%=urlEncodedURL%>");
chart1.render("chartdiv1");
/script>
select name="range" onchange="submitChart('1','01-may-08','31-may-08')">
option value ="0">1 week
option value ="1">2 weeks
option value ="2">3 weeks
option value ="3">1month
option value ="4">2months
/select>
The code tag wasn't working for the last bit of code so I just cut the beginning of the tags.
I'm using Firefox 2 and IE 7 with Tomcat and java 1.4.2.
Thanks,
Fabio