File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Drawing graphs for mathematical functions using Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Drawing graphs for mathematical functions using Java" Watch "Drawing graphs for mathematical functions using Java" New topic
Author

Drawing graphs for mathematical functions using Java

udayshankar kintali
Greenhorn

Joined: Jan 15, 2012
Posts: 15
Hi All,

I want to draw graphs for mathematical functions (trigonometric function) using Java and also determine the minimum and maximum values for that function. Can anyone please suggest the API to be used and some sites where I can get some samples.

I came across this API called jGraphT , how effective is that?
John Vorwald
Ranch Hand

Joined: Sep 26, 2010
Posts: 139
I'm not sure what you are looking for, but JFreeChart has a number of chart types. Here's one place to look at samples. http://www.java2s.com/Code/Java/Chart/CatalogChart.htm
Also, google for jfreechart tutorial.
udayshankar kintali
Greenhorn

Joined: Jan 15, 2012
Posts: 15
Hi John,

I have to draw a graph for a mathematical function.
Let us say I have to draw a graph for sine function, that is my question. I hope I am clear on that.
John Vorwald
Ranch Hand

Joined: Sep 26, 2010
Posts: 139
Try this example
http://www.java2s.com/Code/Java/Chart/JFreeChartXYSeriesDemo.htm

Change the lines like
series.add(1.0, 500.2);
to something like
for (double xValue = xMin; xValue <= xMax; xValue+=dX) {
double yValue = f(xValue);
series.add(xValue, yValue);
}

But, you may need to allocate an array for the x/y values so that the values remain.

Or, this example may be easier to implement, since the x/y are assigned to a dataset in a separate function.
http://www.java2s.com/Code/Java/Chart/JFreeChartWaterTemperatureDemo.htm

I do this quite a bit, making various types of charts using jFreeChart.

Good Luck
John
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drawing graphs for mathematical functions using Java