Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bar graph using database items

 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to convert my database figures into a bar graph. I am thinking of using Apache POI or Jcommon. Which one willl be helpful? The database will be oracle 10g and Netbeans IDE.
I am a newbie. So can anyone provide me with a sample code, it'll be very helpful. It'll be a stand alone application.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12185
34
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Noopur Kore wrote:I am a newbie. So can anyone provide me with a sample code, it'll be very helpful.

It might be helpful, but it won't happen here. We will help you figure it out, but our philosophy is that you will learn more by doing it yourself.

So...Where exactly are you stuck? Building a bar graph is an independent problem from getting data from a database. These two pieces should be completely separate from each other.
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Making a bar graph is the problem.. I can get the data from database..
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JFreeChart can do that, as will the cewolf library (see my signature) if this is a web app. If you search the web you'll find many introductory articles regarding JFreeChart. For cewolf, there's an example web app on SourceForge that should help a lot.
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't ever imported libraries which i can do if I try. And I have also not worked on graphical objects. A sample code on horizontal or vertical bar graph will be helpful so I can ask my further queries too. And What about Apache POI?? It won't work?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the Apache POI web site you will see what it does (and does not) do.

If you have never worked with external libraries then you'll have to go through a bit of a learning curve on such topics as the classpath. You will need to learn that anyway - the earlier, the better. The Oracle Java Tutorial has an extensive section on that.

You haven't told us what kind of application this is -desktop? web app?- so it's hard to point you in the right direction. Here's an example for a desktop app: https://www.coderanch.com/how-to/java/JFreeChartDemo
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It wont be a web app. A desktop app. I learnt importing external libraries. I just now need a to know how to implement them. Thank you.
And about the demo code, it will plots points, right? What should I do if I want a bar graph?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What should I do if I want a bar graph?

Consult the JFreeChart javadocs to see which ChartFactory.create... method is appropriate for that.
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please a sample code!!
 
Campbell Ritchie
Sheriff
Pie
Posts: 49773
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Noopur Kore wrote:please a sample code!!
Please read this post.

Do we have a going round in circles smilie? It would be useful for this thread.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You already have sample code that shows how to use JFreeChart in a desktop app. If looking up the API documentation is too much hassle for you to go through for your own work, it's certainly too much hassle for us to go through for your work.
 
Noopur Kore
Ranch Hand
Posts: 77
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thats ok. thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic