ktsha Report post Posted March 29, 2009 Dear all, I had created a fusion chart of StackedBar3D .I am successfull in getting the fusion chart. Now i am trying to implement a Drill down chart by caling a javascript function. My codes are like written below StringWriter chartXML = new StringWriter(); XMLStreamWriter2 xStreamWriter2 = (XMLStreamWriter2) xOutputFactory.createXMLStreamWriter(chartXML); xStreamWriter2.writeStartDocument(); xStreamWriter2.writeStartElement("chart"); xStreamWriter2.writeStartElement("categories"); for (Map map : resultList) { xStreamWriter2.writeStartElement("category"); xStreamWriter2.writeAttribute("label", (String) map.get("status_name")); // label names are displaying successfully //for implementing drill down chart from the documentation i found using the link attribute and calling the javascript function. According to documentation i written like this where updateFusionChart is the Javascript function. xStreamWriter2.("link","j-updateFusionChart-""+newCondQuery+"","" +FuncName+"",""+status_name+"",""+DrillDownKPI+"""); //xStreamWriter2.writeAttribute("link","javaScript:updateFusionChart(""+newCondQuery+"","" +FuncName+"",""+(String)map.get("status_name")+"",""+DrillDownKPI+"" )"); xStreamWriter2.writeEndElement();// category } xStreamWriter2.writeEndElement(); // categories I am trying to implement a Stacked Column 3D chart and i am successfull in generating it. When i pointed my mouse curson on the generated chart even the link cursor is also not displaying.I am facing the problem of link. Is there any problem with my link attribute and the javascript calling method. i tried with the two ways of calling javascript function.The second one is commented in the code I am a premium customer of Fusion Chart. Currently i am using Fusion chart version 3.1. Please Help me .... Share this post Link to post Share on other sites
FusionCharts Support Report post Posted March 30, 2009 Hi shajeerkt, Could you please send us the XML that is being generated. Please also specify whether you are using dataXML or dataURL method. You might pass us the code that you are using to render the chart. It seems that there might be some issue with the quote that is encapsulating the parameter that for the link. Share this post Link to post Share on other sites
ktsha Report post Posted March 30, 2009 my code is not displaying in my replies. What should i do now. i put it in between Share this post Link to post Share on other sites
ktsha Report post Posted March 30, 2009 here is my javascript function i am calling 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; } } i am using dataURL method. This is my java file 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"); System.out.println(" ================ > (String) series[j] :" + (String) series[j]); xStreamWriter2.writeAttribute("seriesName", (String) series[j]); // xStreamWriter2.writeAttribute("color", "A66EDD"); 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.writeAttribute("link","JavaScript:sample();"); //k++; 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("bgColor", "666666"); 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("bgColor", "666666"); xStreamWriter2.writeAttribute("bold", "1"); // xStreamWriter2.writeAttribute("color", "FFFFFF"); 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(""", "'"); } When i tried with fire bug the error was "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 Any help will be appreciated. I am unable to post my XML generated .How can i post my XML. Share this post Link to post Share on other sites
FusionCharts Support Report post Posted March 30, 2009 Hi, Please attach the XML file and the code as text file as attachment to this post. Share this post Link to post Share on other sites
ktsha Report post Posted March 31, 2009 Hi sudipto, please find the attachments of xml,js and java file in which my chart is rendering . It will be very kind of you if you can give me a solution . xml.txt js.txt java.txt Share this post Link to post Share on other sites
FusionCharts Support Report post Posted March 31, 2009 Hi , I find your link definition is as follows: 1 sample: updateFusionChart("1%3D1+AND+THE_DATE+%3E%3D+TO_DATE%28%2701.01.2008%27%2C+%27DD.MM.YYYY%27%29","HumanResources (Development)","Canceled","" );' Please note that instead of " you have used ". This is invalid. Please change your code so that it renders the link as this: updateFusionChart("1%3D1+AND+THE_DATE+%3E%3D+TO_DATE%28%2701.01.2008%27%2C+%27DD.MM.YYYY%27%29","HumanResources (Development)","Canceled","" ); I have tried reaplacing all ". to " and it worked! Share this post Link to post Share on other sites
ktsha Report post Posted March 31, 2009 Thanks Sudipto for your great help. Its working fine now. Share this post Link to post Share on other sites
Guest Basundhara Ghosal Report post Posted November 16, 2009 Hi, You are most welcome. We are glad to help you. Happy FusionCharting. Share this post Link to post Share on other sites