views:

122

answers:

5

I am using JSP with Springframework, and i have to generate Graphs ( Bar , Pie ... ). Is there any free library/api which can be used to achieve this?

+2  A: 

Does the Google Charts API not meet your needs?

Stefan Kendall
Problem with Google Charts API is that it exposes the data to outer world and in some cases this is a huge no-no. It's a nice API though.
Esko
If it is from Google it ought to be good. :) i will have to try this too alongwith `JFreeChart`. +1 to both
Rakesh Juyal
@Esko: Really? Do you have proof?
Stefan Kendall
@Stefan - the proof is in the link you've posted above. Google Charts API is called over plain http which means anybody can listen in. Mind you, I'm not saying it's necessarily bad (and neither did Esko - he said "in some cases").
ChssPly76
Ah, I see. I thought he meant there was some sort of harvesting of call data. Running over HTTP is always an issue and should be considered, but I thought Esko meant something more.
Stefan Kendall
+10  A: 

JFreeChart is arguably the best one for server-side chart generation

ChssPly76
+1 for JFreeChart!
Omnipresent
Chss, can we click on the generated chart and bifurcate it on some criteria ?
Rakesh Juyal
In web context, Chart is rendered as image with (optional) associated image map. You can handle clicks as you want, but re-rendering (if needed) will have to be done server-side although new image can certainly be retrieved dynamically. If you need a truly dynamic experience, consider one of the javascript-based charting packages like Flot: http://code.google.com/p/flot/
ChssPly76
+3  A: 

JFreeChart has some alternatives like JChart or the one mentioned in its FAQ but there is no real competition.

More recently, I've discovered charts4j, an API on top of Google Charts API that hides the ugly details of creating the URL (you use its Java API to generate the URL). It looks nice if you want to use Google Charts (which might not be an option at all).

Pascal Thivent
So `charts4j` actually **calls** Google Charts, but from server side? That actually seems like the worst of both worlds, to be honest - I must be missing something. I'm genuinely interested here - why would you choose that over the very same jFreeChart or talking to Google Charts client-side? Thanks, your reply would be most appreciated.
ChssPly76
My understanding is that so it hides the ugly details of creating the URL (you use its Java API to generate the URL, not the chart).
Pascal Thivent
Oh, I see. Thanks, I knew I was missing something. That's an interesting approach, +1.
ChssPly76
+1 for charts4j. Didn't know about that, although I knew something to that effect had to exist.
Stefan Kendall
+1  A: 

JFreeChart is a great API.

You can also create scalable vector graphics (SVG) using Apache Batiks. SVG Graphics are XML Based and are computed through mathematical equations (vs. pixel representation of raster graphics) and these graphics are highly scalable without losing the quality.

See Batiks Website: http://xmlgraphics.apache.org/batik/

Kushal Paudyal
A: 

Depending on what you want to plot, graphviz is a great way to generate graphs. Not pie or bar charts, but terribly handy if that's what you need.

duffymo