ktsha Report post Posted March 30, 2009 Dear all, Some body please help me to solve this issue. I am facing a fusion chart Drill down problem. i was trying to create a drill down chart. Please find my attached files.(java file and javascript files) private String getStack2D_Request_XML1(HttpServletRequest request,String condQuery,boolean forDataURL, String kpi, String L1, String L2, String L3, String condtion, boolean links, String DrillDownKPI) { SqlMapClient sqlMapClient = (SqlMapClient) getServletContext().getAttribute("sqlMapClient"); Map sqlParams = new HashMap(); String FuncName; List> resultList = null; sqlParams.put("whereCase",condQuery); sqlParams.put("whereCase_ServProvider",condtion); StringWriter chartXML = new StringWriter(); try { resultList = (List>) sqlMapClient.queryForList(kpi, sqlParams); XMLOutputFactory xOutputFactory = XMLOutputFactory.newInstance(); XMLStreamWriter2 xStreamWriter2 = (XMLStreamWriter2) xOutputFactory.createXMLStreamWriter(chartXML); xStreamWriter2.writeStartDocument(); xStreamWriter2.writeStartElement("chart"); if(resultList.size() >=1 ){ xStreamWriter2.writeAttribute("palette", "2"); xStreamWriter2.writeAttribute("showValues", "0"); xStreamWriter2.writeAttribute("animation", "1"); xStreamWriter2.writeAttribute("formatNumberScale", "0"); xStreamWriter2.writeStartElement("categories"); int start = 0; List funcNameList = new ArrayList(); List statusNameList = new ArrayList(); for (Map map : resultList) { FuncName = (String) map.get("func_name");// Human Resources, if (FuncName != null) FuncName = FuncName.replaceAll("&", "And"); else FuncName = "ALL"; funcNameList.add(FuncName); String status_name = (String) map.get("status_name"); statusNameList.add(status_name); xStreamWriter2.writeStartElement("category"); xStreamWriter2.writeAttribute("label", (String) map.get("status_name")); xStreamWriter2.writeEndElement();// category } xStreamWriter2.writeEndElement(); // categories int i,k ; Object[] series = (Object[]) resultList.get(0).keySet().toArray(); for (int j = 2; j < series.length-1; j++) { xStreamWriter2.writeStartElement("dataset"); xStreamWriter2.writeAttribute("seriesName", (String) series[j]); for (i = start,k = 0; i < resultList.size(); i++,k++) { Object[] record = (Object[]) resultList.get(i).values().toArray(); xStreamWriter2.writeStartElement("set"); String newCondQuery = URLEncoder.encode(condQuery); xStreamWriter2.writeAttribute("value", "" + record[j]); /*xStreamWriter2.writeAttribute("link","j-updateFusionChart(""+newCondQuery+"",""+funcNameList.get(k)+"",""+statusNameList.get(k)+"",""+DrillDownKPI+"");");*/ xStreamWriter2.writeAttribute("link","JavaScript:updateFusionChart(""+newCondQuery+"",""+funcNameList.get(k)+"",""+statusNameList.get(k)+"",""+DrillDownKPI+"" );"); xStreamWriter2.writeEndElement(); // set } xStreamWriter2.writeEndElement(); // dataset } xStreamWriter2.writeStartElement("styles"); xStreamWriter2.writeStartElement("definition"); xStreamWriter2.writeStartElement("style"); xStreamWriter2.writeAttribute("name", "CaptionFont"); xStreamWriter2.writeAttribute("type", "font"); xStreamWriter2.writeAttribute("size", "11"); xStreamWriter2.writeAttribute("bold", "1"); xStreamWriter2.writeAttribute("color", "666666"); xStreamWriter2.writeEndElement(); // style xStreamWriter2.writeStartElement("style"); xStreamWriter2.writeAttribute("name", "LabelsFont"); xStreamWriter2.writeAttribute("type", "font"); xStreamWriter2.writeAttribute("size", "11"); xStreamWriter2.writeAttribute("bold", "1"); xStreamWriter2.writeEndElement(); // style xStreamWriter2.writeEndElement(); // definition xStreamWriter2.writeStartElement("application"); xStreamWriter2.writeStartElement("apply"); xStreamWriter2.writeAttribute("toObject", "CAPTION"); xStreamWriter2.writeAttribute("styles", "CaptionFont"); xStreamWriter2.writeEndElement(); // apply xStreamWriter2.writeStartElement("apply"); xStreamWriter2.writeAttribute("toObject", "DataLabels"); xStreamWriter2.writeAttribute("styles", "LabelsFont"); xStreamWriter2.writeEndElement(); // apply xStreamWriter2.writeEndElement(); // application xStreamWriter2.writeEndElement(); // styles } xStreamWriter2.writeEndElement(); // chart xStreamWriter2.writeEndDocument(); xStreamWriter2.flush(); xStreamWriter2.close(); } catch (Exception e) { System.out.println("Exception occurred" + e.toString()); e.printStackTrace(); } return chartXML.toString().replace(""", "'"); } My javascript function: function updateFusionChart(condQuery,Mngmnt,stutus,kpi,serviceID){ alert("hi"); if ( !serviceID){ var strURL = "ChartServlet?GM=" + Mngmnt + "&status=" +stutus + "&kpi=" +kpi+ "&condQuery=" +condQuery; strURL = escape(strURL); var chart_CityDetails = new FusionCharts('FusionCharts/StackedBar3D.swf?ChartNoDataText=Click right chart to view Services Details', 'ServDetails', '550', '450', '0', '1'); chart_CityDetails.setDataURL(strURL); chart_CityDetails.render(Mngmnt+kpi+"ServDetailsDiv"); } else if (serviceID){ var strURL = "ChartServlet?GM=" + Mngmnt + "&status=" +stutus + "&serviceID=" +serviceID + "&kpi=" +kpi+"&condQuery="+condQuery; //URLEncode it - NECESSARY. strURL = escape(strURL); var chart_CityDetails = new FusionCharts('FusionCharts/StackedBar3D.swf?ChartNoDataText=Click right chart to view Services Details', 'SubServDetails', '800', '450', '0', '1'); chart_CityDetails.setDataURL(strURL); chart_CityDetails.render(Mngmnt+kpi+"SubServDetailsDiv"); } else { //Show error alert("Please wait for the charts to load."); return; } } My first chart is generating successfully. But when i clicked on a bar the link is not calling my javascript function .I tried with firebug .I am using a StackedBar3D. it was telling "syntax error javascript:updateFusionChart("1=1%20AND%20THE_DATE%20>=%20TO_DATE('01.01.2008',%20'DD.MM.YYYY')","Human%20Resources%20(Development)","Closed",""%20); Line 1 Please help me. Share this post Link to post Share on other sites
FusionCharts Support Report post Posted March 30, 2009 (edited) Hi, I find from your post that the link generated is : updateFusionChart("1=1%20AND%20THE_DATE%20>=%20TO_DATE('01.01.2008',%20'DD.MM.YYYY')","Human%20Resources%20(Development)","Closed",""%20); Could you please try using " for all the " and ' for all ' in side the link attribute's value? Edited March 30, 2009 by Guest Share this post Link to post Share on other sites
ktsha Report post Posted March 30, 2009 Hi sudipto, This is my link attribute value String newCondQuery = URLEncoder.encode(condQuery); xStreamWriter2.writeAttribute("link","JavaScript:updateFusionChart(""+newCondQuery+"",""+funcNameList.get(k)+"",""+statusNameList.get(k)+"",""+DrillDownKPI+"" );"); and this is the value that i am getting for newCondQuery 1%3D1+AND+THE_DATE+%3E%3D+TO_DATE%28%2701.01.2008%27%2C+%27DD.MM.YYYY%27%29 the " and ' are replaced by URLEncoder. Share this post Link to post Share on other sites
FusionCharts Support Report post Posted March 30, 2009 hi, It would be helpful for us if you can provide us with the XML as attachment file. Share this post Link to post Share on other sites
ktsha Report post Posted March 31, 2009 Hi Sudipto, Please find the atatchment of the xml,js,java file in which my chart is rendering. Any help will be appreciated. xml.txt js.txt java.txt Share this post Link to post Share on other sites
Dhruva Report post Posted March 31, 2009 Hello shajeerkt, Please check this link for a possible solution: http://www.fusioncharts.com/forum/FindPost12823.aspx Share this post Link to post Share on other sites