aspose file tools*
The moose likes JSP and the fly likes JR Free Web Chart Component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JR Free Web Chart Component" Watch "JR Free Web Chart Component" New topic
Author

JR Free Web Chart Component

samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
hello, i need to produce some charts with my jsp web system. i've downloaded the JR Free Web Chart Component but i dont know how to install or use it correctly. With the pakage, there's a .jar file and an example jsp file. i've put the .jar file in the web-inf folder and try to test run the example file. The example file's codes are as follows:

//-------------------
<%@ page import = "net.comrom.chart.*" %>
<%@ page import = "net.comrom.chart.gc.*" %>
<%
String encode="jpeg";
//String uri=request.getRequestURI();
//String myurl="http://"+request.getHeader("Host")+uri.substring(0,uri.length()-12); //12 ist the length of my page name


response.setContentType("image/jpeg");
response.setDateHeader ("Expires",0);
// get output stream
java.io.OutputStream outb=response.getOutputStream();

// size of the chart image
int w=580;
int h=350;

// data
double[] d1={20,52.1,85.2,125.2,112,251,542.2};
LineDataSerie data1= new LineDataSerie(d1,new LineStyle(1f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_DOTS));
data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10);
data1.valueColor=GraphicsProvider.getColor(ChartColor.BLUE);
data1.valueFont=GraphicsProvider.getFont("Arial",ChartFont.BOLD,10);

// create title
Title title=new Title("the Output Amount of ProductA(1995-2001)");
title.color=GraphicsProvider.getColor(ChartColor.BLACK);

// create axis
Axis XAxis=new Axis(Axis.HORIZONTAL,new Scale());
Axis YAxis=new Axis(Axis.VERTICAL,new Scale());
XAxis.tickAtBase=true; // draw also first tick
XAxis.ceroAxis=Axis.CEROAXIS_NO;
YAxis.ceroAxis=Axis.CEROAXIS_NO;
YAxis.scale.min=0;
YAxis.DescColor=GraphicsProvider.getColor(ChartColor.BLACK);
YAxis.scaleTickInterval=100;
XAxis.scaleTickInterval=1;
XAxis.bigTickInterval=1;
XAxis.DescColor=GraphicsProvider.getColor(ChartColor.BLACK);
String[] lbls={"1995","1996.","1997","1998","1999","2000","2001"};
XAxis.tickLabels=lbls;
XAxis.style =new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL);
YAxis.style =new LineStyle(0.2f,GraphicsProvider.getColor(ChartColor.BLACK),LineStyle.LINE_NORMAL);
YAxis.gridStyle=new LineStyle(1,GraphicsProvider.getColor("0xC0C0C0"),LineStyle.LINE_NORMAL);
XAxis.gridStyle=new LineStyle(1,GraphicsProvider.getColor("0xC0C0C0"),LineStyle.LINE_NORMAL);
XAxis.axisFrame=true;
YAxis.axisFrame=true;

HAxisLabel XLabel= new HAxisLabel("Year",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.ITALIC,12));
VAxisLabel YLabel= new VAxisLabel("thousand",GraphicsProvider.getColor(ChartColor.BLACK),GraphicsProvider.getFont("Arial",ChartFont.ITALIC,12));

// plotter
LinePlotter plot=new LinePlotter();

// create chart
Chart chart=new Chart(title,plot,XAxis,YAxis);
chart.XLabel=XLabel;
chart.YLabel=YLabel;
chart.addSerie(data1);
chart.back=new FillStyle(GraphicsProvider.getColor(ChartColor.WHITE));
chart.setSize(w,h);
chart.saveToFile(outb,"jpeg");
outb.close();

%>
//--------------

however, i got errors and still not able to display the chart. the chart pakage can be retrieved free from http://www.javaresources.biz/ and enter the password www.javaresources.biz/line when u unzip the downloaded zip file.

Please, could anyone help me how to use/install the components correctly so that i can display my charts?

Thank you.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Sending the error message might be quicker. Could you please post the Exception you've received ?


[My Blog]
All roads lead to JavaRanch
samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
hello,
this is the error mesage displayed. The problem lies probably because i havent installed the component properly because i dont know how.
TQ.

--------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

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

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineDataSerie cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineDataSerie cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLACK cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle.LINE_DOTS cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartFont.BOLD cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLUE cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartFont.BOLD cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Title cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Title cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLACK cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Axis cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Axis cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Axis.HORIZONTAL cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Scale cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Axis cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Axis cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Axis.VERTICAL cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Scale cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Axis.CEROAXIS_NO cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Axis.CEROAXIS_NO cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLACK cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLACK cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLACK cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle.LINE_NORMAL cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLACK cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle.LINE_NORMAL cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle.LINE_NORMAL cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LineStyle.LINE_NORMAL cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
HAxisLabel cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
HAxisLabel cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLACK cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartFont.ITALIC cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
VAxisLabel cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
VAxisLabel cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.BLACK cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartFont.ITALIC cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LinePlotter cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
LinePlotter cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Chart cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
Chart cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
FillStyle cannot be resolved or is not a type

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
GraphicsProvider cannot be resolved

An error occurred at line: 211 in the jsp file: /A_Report/WIPbyStation.jsp
Generated servlet error:
ChartColor.WHITE cannot be resolved or is not a type


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Did you put the jar file in the WEB-INF/lib directory ?
samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
yes i have
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

LineDataSerie is in the net.comrom.chart package, which is imported in the JSP file. Check that you have the right jar in WEB-INF/lib.
Which JAR file did you download ?
samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
there's only one file with the name chart.jar..i put it in the web-inf/lib folder.but that's
samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
there's only one file with the name chart.jar..i put it in the web-inf/lib folder.but that's the only thing i did.
is there any other installation step that i missed? probably some additional line of codes in the web.xml file?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I guess that there's some other library missing... Did you read document.txt in the archive ? (I can't extract it)
samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
did u use the password?
www.javaresources.biz/line
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

What is this link ? It gives me an error page.
samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
that's not a link..

this is the link where you can download the chart component (zip file)
http://www.javaresources.biz/line.jsp

to extract the file, the password is:
www.javaresources.biz/line --> this is the password

TQ for your helps
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Ok. Strange, it works for me. What I did is :

1. I've got a web application called 'myapp'
2. Put chart.jar in /myapp/WEB-INF/lib
3. Put line.jsp in /myapp/
4. Start Tomcat
5. Access page via http://localhost:8080/myapp/line.jsp

And it worked.
Did you restart your server after installing the jar file ?
samart mateo
Ranch Hand

Joined: Feb 06, 2006
Posts: 37
ok, i think i got it already..i put the line.jsp file in a sub-folder in my system. maybe i need to change some directory address or something.

Thank you anyway. Thanx very much
 
Consider Paul's rocket mass heater.
 
subject: JR Free Web Chart Component
 
Similar Threads
reducing space in graph with FreeWebLineChart4J
trouble with Runtime.exec()
2D graphic repaint() logic
cewolfexample (cewolf-1.1-ulf)
Ploticus users : defining an output file