Is there a public library for Java (free) that can be used to display graphs (I am talking about discrete graphs - not bar charts, pie charts, etc...)?
-
Do you mean something like this http://www.jfree.org/index.html – GustyWind Sep 03 '10 at 12:09
-
ExtremeCoder, why don't you help yourself by naming examples of the kinds of graphs you want. Telling us what you don't want is necessary but not sufficient. X-Y plots of functions? Scatter plots? Renderings of statistical concepts? Help us help you. – duffymo Sep 03 '10 at 12:27
7 Answers
The JUNG (Java Universal Network/Graph Framework) framework allows you to sample their various graphing layouts online. Here is a screen shot of the ShowLayouts2 demo:

- 46,244
- 33
- 149
- 164
JFreeChart is good.
And if laying out graphs is what you're after, I'd recommend AT&T's graphviz as an alternative. Give it the data and it lays out the graph for you.

- 305,152
- 44
- 369
- 561
-
1
-
1@Bart K., I don't think you really know what the OP needs. It's not well stated at all. – duffymo Sep 03 '10 at 12:26
-
true, I am (or was, now that my answer is the accepted one) not 100% sure but the comment of the OP that s/he didn't want bar- or pie charts, seemed to me clear that the mathematical kind of graphs were meant. Don't you agree? – Bart Kiers Sep 03 '10 at 12:32
-
No, I do not. Your answer might have been accepted, but that doesn't mean that the OP knows what they're doing or that you're correct. Bar or pie charts can certainly represent mathematical concepts when appropriate, so your partitioning into "manager" and "mathematical" charts is arbitrary and wrong. And neither you nor the OP has been specific about exactly what "mathematical" graphs are. Don't tell us what they're not. – duffymo Sep 03 '10 at 12:35
-
Okay, then we disagree on that. I clarified my "loose terminology" already in the other comment. But take it easy, I didn't mean to offend you (which it seems to me you are a bit. Of course, I could be wrong about that: hard to tell on forums). – Bart Kiers Sep 03 '10 at 12:41
If using Google's Chart API is an option, check out Charts4J.
I use it and have had no problems.

- 17,874
- 12
- 64
- 83
-
If I assume that "mathematical graphs" means x-y plots of typical functions, JFreeChart can create those. I know a lot of math, both continuous and discrete, and I know what it is to be discrete, but I'm not sure that I know what "discrete, mathematical kind" means. And "manager graphs"? C'mon. – duffymo Sep 03 '10 at 12:25
-
@Duffy, by discrete I meant 'discrete math'. And I put a smiley behind by remark. IMO, you're being pedantic right now. – Bart Kiers Sep 03 '10 at 12:38
-
"Discrete math" would have been far more correct than "discrete, math". It's not pedantic - go read "Eats, Shoots, and Leaves". Your "smilely" came after "manager graphs. – duffymo Sep 03 '10 at 12:41
-
@Duffy, The pedantic remark was about your comment: *"And "manager graphs"? C'mon."* – Bart Kiers Sep 03 '10 at 12:42
-
I'm saying that your division into categories is arbitrary and incorrect. – duffymo Sep 03 '10 at 12:44
-
@Duffy, yes I agree with you on that (hence the removal of my first remark). – Bart Kiers Sep 03 '10 at 12:53
JFreeChart. The code is free. You have to pay for the authors docs, but there are plenty of examples around and it's pretty easy to learn to use.

- 29,538
- 35
- 110
- 138
-
Hmm. Maybe I'm wrong but am pretty sure JFree can do things like this: http://www.mathworks.com/help/techdoc/creating_plots/f10-1188.html Maybe the OP should post a link to an example – Joel Sep 03 '10 at 12:19
-
AFAIK, the op meant these graphs: http://en.wikipedia.org/wiki/Graph_theory – Bart Kiers Sep 03 '10 at 12:36
Sorry, I misunderstood the question. The thing you are looking for is called JUNG - the Java universal network/graph library. It can store, display and calculate various metrics on sparse or dense graphs. The official site has excellent samples.
Quote from the website above:
"The JUNG architecture is designed to support a variety of representations of entities and their relations, such as directed and undirected graphs, multi-modal graphs, graphs with parallel edges, and hypergraphs. It provides a mechanism for annotating graphs, entities, and relations with metadata. This facilitates the creation of analytic tools for complex data sets that can examine the relations between entities as well as the metadata attached to each entity and relation."

- 15,487
- 9
- 60
- 79
-
1How is this new information? And if that's the case, graphviz might be another choice. – duffymo Sep 03 '10 at 12:38
There is a Graphviz library for Java at http://www2.research.att.com/~john/Grappa/. I have used Graphviz for a project in the past to draw graphs and I found it quite easy to use. If you are just looking for a server side solution, then you could just use a standard Graphviz distribution and send it the commands with the "dot" syntax that it uses.

- 144
- 6