I'm trying to create simple XYSplineRenderer, but code only work if I write XYDotRenderer a = new XYDotRenderer(); or XYLineAndShapeRenderer a = new XYLineAndShapeRenderer(); Can sameone tell what i do wrong? I'm just beginner in programming.
Here is my code:
package kubas;
import org.jfree.chart.*;
import org.jfree.chart.axis.*;
import org.jfree.chart.plot.*;
import org.jfree.chart.renderer.xy.XYSplineRenderer;
import org.jfree.data.xy.*;
import org.jfree.ui.ApplicationFrame;
public class spausdink {
public static void main(String[] args) {
XYSeries series = new XYSeries("XY grafikas");
series.add(1, 2);
series.add(2, 4);
series.add(3, 8);
series.add(4, 16);
series.add(5, 32);
series.add(6, 64);
series.add(7, 128);
series.add(8, 256);
series.add(9, 512);
series.add(10, 1024);
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series);
ApplicationFrame frame = new ApplicationFrame("Mano grafikas");
NumberAxis xax = new NumberAxis("x");
NumberAxis yax = new NumberAxis("y");
XYSplineRenderer a = new XYSplineRenderer();
a.setPrecision(10);
XYPlot xyplot = new XYPlot(dataset, xax, yax, a);
JFreeChart chart = new JFreeChart(xyplot);
ChartPanel chartPanel = new ChartPanel(chart);
frame.setContentPane(chartPanel);
frame.pack();
frame.setVisible(true);
}
}
Edited message:
Both codes work properly, then I created new project.