This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes How to display 2 charts using JDBCCategory Dataset in jfreecharts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "How to display 2 charts using JDBCCategory Dataset in jfreecharts" Watch "How to display 2 charts using JDBCCategory Dataset in jfreecharts" New topic
Author

How to display 2 charts using JDBCCategory Dataset in jfreecharts

Poonam Dhatavkar
Greenhorn

Joined: Jan 11, 2013
Posts: 19
i want to create a 3D Bar Chart in jsp using data from database table.
i am using jfreecharts and JDBCCategory Dataset, it takes data from one table at a time.
And i want to create 2 charts from 2 tables, passing only one query. Is it possible ?

My requirements are like :
On selecting a Name (say ABC) from Options (from another jsp) it should display 2 charts as Production & Sales in last few years.
i can create now 1 chart for Production

i have a table named 'production' and 'sales' like this
--------------------
Year| Total
--------------------
2010-09 | 8
2011-10 | 9
2012-11 | 2
--------------------



I tried creating 2nd using


But it is giving error at line

type Exception report
message An exception occurred processing JSP page /js.jsp at line 35
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /js.jsp at line

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.NullPointerException
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:991)
java.lang.Double.valueOf(Double.java:475)
org.jfree.data.jdbc.JDBCCategoryDataset.executeQuery(JDBCCategoryDataset.java:276)
org.jfree.data.jdbc.JDBCCategoryDataset.executeQuery(JDBCCategoryDataset.java:191)
org.apache.jsp.js_jsp._jspService(js_jsp.java:95)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

But when i change query2="select * from production";
everything goes fine, bt i get2 same charts.

Can anyone help me regarding this ?

Should i use any other dataset ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to display 2 charts using JDBCCategory Dataset in jfreecharts
 
Similar Threads
Anybody used JFreeCharts?
Charts In JSP
unable to display charts in tomcat6.x
Charts In JSP
Refresh chart in jsp according to MySQL database