How to insert a linechart in a Java Server Page

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Veena

How to insert a linechart in a Java Server Page

Post by Veena » Mon Feb 25, 2002 9:04 pm

Hi
I am totally new to JFreeChart. I just started doing my Research. My requirement is to plot a line chart and display it as part of a java server page. I tried the example program for pie chart given in the JFreeChart.pdf file. I included that code in a JSP and I couldn't see anything plotted. Could anyone please help me in meeting my requirement.

Thanks in advance
Praveena

padaek

Re: How to insert a linechart in a Java Server Page

Post by padaek » Mon Feb 25, 2002 9:29 pm

I'm new to JFreeChart as well, but I would imagine that you would have to either convert the chart object to an Applet --- or write the chart to a graphics file.

Hari

Re: How to insert a linechart in a Java Server Page

Post by Hari » Tue Feb 26, 2002 5:50 am

You can't insert an image directly in the JSP since the resulting document is HTML. You can use the *Servlet* supplied with the JFreeChart distribution to generate the image (in PNG format) and can be viewed on the HTML page using the <IMG> tag.

<img src="/servlet/YourChartingServlet">

where "YourChartingServlet" will produce a PNG format Image. For more information, you can go through *JFreechartServletDemo" source code.

Veena

Re: How to insert a linechart in a Java Server Page

Post by Veena » Tue Feb 26, 2002 6:46 pm

Thanks for your responses

Hari

If you have a running servlet class for any chart could you please send me the class and source to my mail address which is Praveena_S@ureach.com I would like to test the above suggestion you made but I don't know where to start.

Thanks
Praveena

Locked