using JFreeChart in a servlet

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
nsiri mehdi

using JFreeChart in a servlet

Post by nsiri mehdi » Mon Aug 28, 2000 4:24 pm

I want to use jfreechart in a servlet ,I allready saw the solution but the code is court and i want exactelly to see how we can introduce the code source java in a servlet web (just the begining)

Private Heath

RE: using JFreeChart in a servlet

Post by Private Heath » Wed Sep 27, 2000 5:52 pm

I hope this helps

The bulk of the code to help yu get started in here! On this site . You will have to make some modifications to the But this is straight forward. I have included it below.

JFreeChartPanel t = createChartPanel(req);
ImageProducer image = convertToGIF(t,req.getParameter("transparent")!=null);
* Override me!
protected JFreeChartPanel createChartPanel(HttpServletRequest req)
throws ServletException,IOException

Number [][] data = new Integer [][]
{new Integer(12), new Integer(13),
new Integer(16), new Integer(98) },
{ new Integer(45), new Integer(78),
new Integer(54), new Integer(15) },
{ new Integer(123), new Integer(15),
new Integer(132), new Integer(14)},
{ new Integer(12), new Integer(14),
new Integer(135), new Integer(18)}

CategoryDataSource myDataSource = new DefaultCategoryDataSource(data);
JFreeChart myChart = JFreeChart.createVerticalBarChart(myDataSource);
JFreeChartPanel myChartPanel = new JFreeChartPanel(myChart);
return myChartPanel;

Private Heath

Post Reply