Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to display the charts using jsp  RSS feed

 
Anand Nuchchi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Am trying to display the chart like bar chart
using JSP. am using tomcat server.

And i collected some code from net:
Link is: " http://www.swiftchart.com/examplebar.htm#top "
And Paste the code

====
<html>
<body>
<%@ page session="false"%>
<%@ page contentType="image/jpeg" import="com.sun.image.codec.jpeg.*,swiftchart.swiftchart_app.*" %>
<%
swiftchart.swiftchart_app mychart= new swiftchart.swiftchart_app(400,300);
mychart.setParam("x_axis_font_orientation","HORIZONTAL");
mychart.setParam("chart_type","bar");
mychart.setParam("applet_bg","EEEEEE");
mychart.setParam("chart_bg","FFFFFF");
mychart.setParam("title_text","Bar chart");
mychart.setParam("title_font_color","000000");
mychart.setParam("title_font_size","18");
mychart.setParam("x_axis_font_color","000000");
mychart.setParam("x_axis_font_size","12");
mychart.setParam("y_axis_font_color","000000");
mychart.setParam("y_axis_font_size","12");
mychart.setParam("legend_position","RIGHT");
mychart.setParam("legend_font_color","000000");
mychart.setParam("legend_font_size","12");
mychart.setParam("data_value","NONE");
mychart.setParam("data_value_font_color","000000");
mychart.setParam("data_value_font_size","12");
mychart.setParam("grid_line","Y");
mychart.setParam("grid_line_color","999999");
mychart.setParam("x_value","Jan,Feb,Mar,Apr,May,Jun");
mychart.setParam("s1_value","22,34,38,29,32,28");
mychart.setParam("s1_label","Serie 1");
mychart.setParam("s1_color","6699CC");
FileOutputStream fos = new FileOutputStream("out.jpg");
JPEGImageEncoder jpeg = JPEGCodec.createJPEGEncoder(fos);
jpeg.encode(mychart.getChart());
fos.close();
</body>
</html>

====
but its showing some error like....

=====
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 4 in the jsp file: /chart/cc.jsp

Generated servlet error:
[javac] Compiling 1 source file

D:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\chart\cc_jsp.java:8: package swiftchart.swiftchart_app does not exist
import swiftchart.swiftchart_app.*;
^
D:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\chart\cc_jsp.java:46: package swiftchart does not exist
swiftchart.swiftchart_app mychart= new swiftchart.swiftchart_app(400,300);
^



An error occurred at line: 4 in the jsp file: /chart/cc.jsp

Generated servlet error:
D:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\chart\cc_jsp.java:46: package swiftchart does not exist
swiftchart.swiftchart_app mychart= new swiftchart.swiftchart_app(400,300);
^
3 errors
=====

So to display wat are the steps to follow plz guide me.


thanks in advance
Anand.
 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

D:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\chart\cc_jsp.java:8: package swiftchart.swiftchart_app does not exist
import swiftchart.swiftchart_app.*;
^
D:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\_\chart\cc_jsp.java:46: package swiftchart does not exist
swiftchart.swiftchart_app mychart= new swiftchart.swiftchart_app(400,300);


Your code is complainig about the missing package swiftchart. Its either you
DONOT have the swiftchart library or you have it AND ITS NOT on your classpath i.e. lib.

I suggest you make sure you have the package on your classpath
[ June 19, 2006: Message edited by: Ola Daniel ]
 
badri nath
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anand

org.apache.jasper.JasperException: Unable to compile class for JSP

This is a classpath eror..try to set your classpath and there is nothing that has been modified in the code according your requirement.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!