Learn how to a build a cloud-first strategyRegister Now


How to make a graph in Java using Netbeans?

Posted on 2011-05-04
Medium Priority
Last Modified: 2013-12-14
How can I create a graph in Java using Netbeans? Most of the forum posting that I find on the internet that answer this question just lead to a link to JFreeChart which I wouldn't mind trying but I am on a tight deadline 24hrs and I would like some good advice on the easiest method to do this (I don't want to go 8 hours in the wrong direction).  I don't mind if it isn't elegant I just need it to be able to graph two arrays within a project.

Question by:AdrianME
  • 3
  • 2
  • 2
LVL 92

Expert Comment

ID: 35691917
LVL 47

Expert Comment

ID: 35691979

JFreeChart is also simple, and there are many exmaples avialble:

They are claiming that this is one very simple:

Author Comment

ID: 35692591
Thank you again for the suggestions.  I am trying to create 3 plots and I have done so with Matlab so that I can check my results.  

@object - Is there an example using Swing that would work for a line graph?

@yan - I looked at the JFreeChart and it has a line graph would it generate this type of output?

Sample Output
7878967ghjkgg67493.PNG 789018790321423893.PNG
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 92

Expert Comment

ID: 35692747
not aware of any simple line graph examples sorry.
shouldn't be too hard to adapt the code above.
With a line graph your just draw a line from each data point to the next so its actually simpler than a line graph.
LVL 47

Accepted Solution

for_yan earned 2000 total points
ID: 35693363
This is waht  this thing plots:


But you know - very important to have exactly specific versions of jars - so
I could do it only with jfrechart-0.9.20 and most importnat jcommon-0.9.5.jar


Neither jcommon-1.., nor jcommon-0.9.1 would work.
Look, maybe it qwould work for you

Author Comment

ID: 35694749
I think that could work for me but I am finding installing the JFreeChart very difficult.

I will try your suggestion and start a new question on installing JFreeChart.  

Thanks.  That will do the trick.


Author Closing Comment

ID: 35716908
JFreeChart is an excellent software.  Installing it can be a bit tricky but once you have it in the graph quality is excellent.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question