Eae pessoal,
Seguinte, estou tentando plotar dois graficos, consigo plotá-los mas não consigo visualizar a maioria do gráfico.
Alguém sabe como resolver isso ??
jfreechart-1.0.1 :
Esse é o código:
import java.awt.Dimension;
import javax.swing.JPanel;
import org.jfree.chart.*;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.*;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
import java.lang.*;
public class AutoVetores extends ApplicationFrame
{
public AutoVetores(String s)
{
super(s);
XYDataset xydataset = createDataset();
JFreeChart jfreechart = createChart(xydataset);
ChartPanel chartpanel = new ChartPanel(jfreechart);
chartpanel.setPreferredSize(new Dimension(500, 270));
setContentPane(chartpanel);
}
private static JFreeChart createChart(XYDataset xydataset)
{
JFreeChart jfreechart = ChartFactory.createXYLineChart("Auto-Vetores", "Reais", "Imaginarios", xydataset, PlotOrientation.VERTICAL, true, true, false);
return jfreechart;
}
private static XYDataset createDataset()
{
XYSeries xyseries = new XYSeries("Auto-Vetor 1");
for(int x=0; x < 50; x++) {
xyseries.add(x,(Math.pow(x,2D) + 2));
}
XYSeries xyseries1 = new XYSeries("Auto-Vetor 2");
for(int x=0; x < 100; x++) {
xyseries1.add(x,(-Math.pow(x,2D) + 2));
}
XYSeriesCollection xy = new XYSeriesCollection();
xy.addSeries(xyseries);
xy.addSeries(xyseries1);
return xy;
}
public static JPanel createDemoPanel()
{
JFreeChart jfreechart = createChart(createDataset());
return new ChartPanel(jfreechart);
}
public static void main(String args[])
{
AutoVetores tela = new AutoVetores("Auto - Vetores");
tela.pack();
RefineryUtilities.centerFrameOnScreen(tela);
tela.setVisible(true);
}
}
O que eu faço pra resolver isso ???