Hi,
I'm having trouble using the taglibs for JSP's and I was wondering is it possible to just pass the JFreeChart object to the JSP in a request and then call the ChartUtilities.writeChartAsJPEG () method passing the appropriate arguments. Has anyone tried to do this? Would anyone know another way of doing it without using the taglibs?
Any help would be much appreciated.
NEIL
Using JSP's
Re: Using JSP's
Hi,
Recently I started with JFreeChart. I am also a problem calling the servlet from the jsp page. It says NoClassFound. I was using it as an action to form submit. I think I am missing somthing with the stettings. I am using tomcat as the server. I did the required settings in the web.xml for the servlet.
Any Suggestions. Thnx in advance.
Sang
Recently I started with JFreeChart. I am also a problem calling the servlet from the jsp page. It says NoClassFound. I was using it as an action to form submit. I think I am missing somthing with the stettings. I am using tomcat as the server. I did the required settings in the web.xml for the servlet.
Any Suggestions. Thnx in advance.
Sang
Re: Using JSP's
hi,
i am in the ame case, i begin with Java and with JFreeChart.
chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 300), new com.jrefinery.chart.DrawInfo());
OutputStream out=System.out;
File file = new File("e:\Esaip\test.jpg");
com.jrefinery.chart.ChartUtilities.saveChartAsJPEG(file, chart, 2, 2);
com.jrefinery.chart.ChartUtilities.writeChartAsJPEG(out, chart, 2, 2);
out.flush();
out.close();
i tried differents methods, nut no one works,
thanks for help,
charlotte.
i am in the ame case, i begin with Java and with JFreeChart.
chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 300), new com.jrefinery.chart.DrawInfo());
OutputStream out=System.out;
File file = new File("e:\Esaip\test.jpg");
com.jrefinery.chart.ChartUtilities.saveChartAsJPEG(file, chart, 2, 2);
com.jrefinery.chart.ChartUtilities.writeChartAsJPEG(out, chart, 2, 2);
out.flush();
out.close();
i tried differents methods, nut no one works,
thanks for help,
charlotte.
Re: Using JSP's
The best way to solve your problem is to follow the JFreeChartServletDemo. Narrow down to your specific case. I retrieve my data from a database for my axis values.
So for example when I used a XYDataSet for my chart, I had:
JFreeChart chart = createChart(type, initGradColor, finalGradColor);
In the createChart() method, pass the data you want to store as an argument when creating the dataset:
XYDataset xyData = createXYData(data) //data is my data from database;
All you need to do is make your data specific to the servlet demo.
Save your chart the way you have been and display it on your JSP by inserting the image
If you have any more questions- I'll do my best!!
NEIL
So for example when I used a XYDataSet for my chart, I had:
JFreeChart chart = createChart(type, initGradColor, finalGradColor);
In the createChart() method, pass the data you want to store as an argument when creating the dataset:
XYDataset xyData = createXYData(data) //data is my data from database;
All you need to do is make your data specific to the servlet demo.
Save your chart the way you have been and display it on your JSP by inserting the image
If you have any more questions- I'll do my best!!
NEIL