Pie Chart 
Output for this is a blank screen, It not thrown any exception..
How can i display pie chart in this page?
Thanks in advance.
Pie Chart 
Output for this is a blank screen, It not thrown any exception..
How can i display pie chart in this page?
Thanks in advance.
after creating the chart save the chart as follow:
ChartUtilities.saveChartAsJPEG(new File(path/piechart.png"),chart,400, 300);
and then
use

**Other way is as discussed in ** How to display line graph using JFreeChart in jsp?
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("image/png"); ServletOutputStream os = response.getOutputStream(); ImageIO.write(getChart(request), "png", os); os.close(); } private RenderedImage getChart(HttpServletRequest request) { String chart = request.getParameter("chart"); // also you can process other parameters like width or height here if (chart.equals("myDesiredChart1")) { JFreeChart chart = [create your chart here]; return chart.createBufferedImage(width, height) }
and display as

see the answer of Martin Lazar here
Finally i got the answer....
.....In servlet....
public void getPieChart() { DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("JavaWorld", new Integer(75)); pieDataset.setValue("Other", new Integer(25)); JFreeChart chart = ChartFactory.createPieChart("Discounts Used by Category ", data, true, true, false); //chart.setBackgroundPaint(new Color(222, 222, 255)); final PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setCircular(true); try { final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); final File file1 = new File(getServletContext().getRealPath(".") + "/images/charts/piechart.png"); ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info); } catch (Exception e) { System.out.println(e); } }
.....in html page......
Pie Chart 
............................................................................
......................Or using only jsp page........
Pie Chart 