File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Bar graph using database items Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Bar graph using database items" Watch "Bar graph using database items" New topic
Author

Bar graph using database items

Noopur Kore
Ranch Hand

Joined: Aug 18, 2012
Posts: 77

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

Joined: Oct 02, 2003
Posts: 11155
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Noopur Kore
Ranch Hand

Joined: Aug 18, 2012
Posts: 77

Making a bar graph is the problem.. I can get the data from database..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
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.


Ping & DNS - my free Android networking tools app
Noopur Kore
Ranch Hand

Joined: Aug 18, 2012
Posts: 77

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
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
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

Joined: Aug 18, 2012
Posts: 77

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
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
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

Joined: Aug 18, 2012
Posts: 77

please a sample code!!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37991
    
  22
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
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
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

Joined: Aug 18, 2012
Posts: 77

thats ok. thanks.
 
Don't get me started about those stupid light bulbs.
 
subject: Bar graph using database items
 
Similar Threads
Setting TextField in Chart using IReport
fluctuation
Graphs in JSF
How do I make dynamic GRAPHS??
Selective retrieval of numbers in a text file