behelmy Report post Posted November 8, 2010 Dears, Hope everything is going well. I need to know how to show a chart from a Servlet. I will not use Jsp. I tried many times but without success. So could anyone put a sample code for an example line2d, for any simple data, using servlet. best regards. Share this post Link to post Share on other sites
behelmy Report post Posted November 9, 2010 hello , if anyone has the answer , please tell me .. How to show a chart from servlet ? appreciate your time. Share this post Link to post Share on other sites
srividya_sharma Report post Posted November 12, 2010 Hi I found this code in archives. Please try it out. I haven't tested it recently. String chartStr = FusionChartsHelper.createChart("FusionCharts/Column2D.swf", "Data/Data.xml", "", "ChartFromServlet", 600, 300, false, false); StringBuffer chartHTML= new StringBuffer(); chartHTML.append("<HTML>"); chartHTML.append("<HEAD>"); chartHTML.append("<TITLE>FusionCharts - Export Example</TITLE>"); chartHTML.append("<script LANGUAGE='Javascript' SRC='FusionCharts/FusionCharts.js'></SCRIPT>"); chartHTML.append("</HEAD>"); chartHTML.append("<BODY>"); chartHTML.append(" <CENTER>"); chartHTML.append(" <h2>FusionCharts Example</h2>"); chartHTML.append("<h4>From servlet</h4>"); chartHTML.append(chartStr); chartHTML.append("<BR>"); chartHTML.append("</CENTER>"); chartHTML.append("</BODY>"); chartHTML.append("</HTML>"); PrintWriter out = response.getWriter(); out.write(chartHTML.substring(0)); The class FusionChartsHelper is present in com.fusioncharts package. Import it in your servlet. Hope this helps. Share this post Link to post Share on other sites