Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to display 2 charts using JDBCCategory Dataset in jfreecharts

 
Poonam Dhatavkar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic