• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to create chart using java api

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi friends, I want to retrieve some data from mysql db and want to show them in pie chart using java API. Is it possible? please give me some ideas how can I achieve this task using java api. thanks in advance....
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Libraries like JFreeChart or JChart2D can do this. If this is part of a web app, check out cewolf, which is a JSP tag library on top of JFreeChart.
 
gow tham
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi dittmer, thank you so much for your response. Definitely I will follow your instructions.
 
gow tham
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is it possible to create a chart using jsp? scenario: 1. I want to retrieve data from mysql db using jav api. 2. I want to show them using chart. I don't want to make this task more complex to using 3 party packages. I would like to do this with inbuild java api. please help me...
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why does it make a difference whether you learn an API built into the JRE, or a 3rd party API? But regardless, the JRE has no charting API built in, so unless you want to roll your own -which I recommend against- you have to use a 3rd party solution. And I still recommend to check out cewolf if you haven't done so yet - download the example web app, deploy it, and see what it can do for you. Or you can use Google Charts if you would rather have a JavaScript solution than a Java solution.
 
gow tham
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you so much for your last explanation. Basically I'm a unit tester, I have to automate that scenario but I struggled for a week to innovate this task. now I get some ideas. please answer my last question. can i use javaScript to perform my scenario? which I queried in my first post.If YES, please tell me the way to achieve or I should concentrate. Regards, santhosh.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

san thosh wrote:can i use javaScript to perform my scenario? which I queried in my first post.


You did not say anything at all about JavaScript in your first post. You asked about a Java API.

If you want to use a JavaScript solution, Ulf already gave you one resource. HighCharts is another.
 
gow tham
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks bibeault. actually I'm planning to integrate(insert) js into jsp to achieve my task. I believe it will be succeed. I will update the status sooner. Regards, santhosh.
 
gow tham
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have facing the following error while compile my java code: TestServlet.java:28:error:unreported exception class not found exception; must be caught or declare be thrown Class.for name("com.mysql.jdbc.Driver");. as per my understanding the java runtime could not find the mysql-connxxx.jar file to load.the following steps i have tried: I haven't use any ide to develop a .java file instead I used notepad and dropped the jfreechart.jar and jcommon.jar,also msql-connect-bin.jar files into tomcathome/lib folder. In command line navigate to my java file I have set my path=jdk location, and set class path=location of servlet-api.jar,jfreechart.jar, jcommon,mysqlconn-bin.jar(from tomcathome/lib dir),and executed javac TestServlet.java command in dos-command, and it throws filenotfoundexception. please let me know where I need to place mysql-conn-bin.jar to recognize java in runtime. please let me know I have missed anything in my steps. thanks in advance...
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have facing the following error while compile my java code: TestServlet.java:28:error:unreported exception class not found exception; must be caught or declare be thrown Class.for name("com.mysql.jdbc.Driver");. as per my understanding the java runtime could not find the mysql-connxxx.jar file to load.


No, the problem is something entirely different. You need to read up on exception handling in Java - if a method can throw an exception, then the code either needs to catch that exception, or the surrounding method needs to declare that it throws that exception. In this case you probably want to catch the exception, and exit the code if it happens, because presumably the code won't get anything done if it can't access the DB for any reason (including a missing JDBC driver).
 
gow tham
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so, the problem with catching exception? not in steps. please let me know my steps are correct which I posted in my last comments.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The second exception you mention indicates that there was a problem, but it's impossible to say whether what you did would work or not without knowing exactly what you did.

Irrespective of that, I generally advise against using the CLASSPATH variable; either using the javac "-cp" option, or using a build tool like Ant are better options IMO.
reply
    Bookmark Topic Watch Topic
  • New Topic