I've been googling my for a while now, and did not find any useful stuff, so that is why I ask you guys.
Can I draw mathematical functions (e.g. sine, cosine, etc.) with JFreeChart?
Thanks
I've been googling my for a while now, and did not find any useful stuff, so that is why I ask you guys.
Can I draw mathematical functions (e.g. sine, cosine, etc.) with JFreeChart?
Thanks
There may not be a built in way to plot sinx but there doesn't need to be. Remember that what your saying is y=sin(x)! What you need to plot is the x and y value. Create a loop of x values then plug them into sin(x) using Java and Math. That answer IS your y value! So now you have your x and y values to plot sin(x).
Example
final XYSeries series1 = new XYSeries("First");
for(double i = 0; i < 10; i += 0.2){
double sinx = Math.sin(i);
series1.add(i, sinx);
}
final XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series1);