I got this panel:
public class StripchartPanel extends javax.swing.JPanel {
public StripchartPanel() {
XYSeries series = new XYSeries("XYGraph");
series.add(1, 1);
series.add(1, 2);
series.add(2, 1);
series.add(3, 9);
series.add(4, 10);
// Add the series to your data set
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series);
// Generate the graph
JFreeChart chart = ChartFactory.createXYLineChart(
"XY Chart", // Title
"x-axis", // x-axis Label
"y-axis", // y-axis Label
dataset, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, // Show Legend
true, // Use tooltips
false // Configure chart to generate URLs?
);
ChartPanel CP = new ChartPanel(chart);
this.add(CP, BorderLayout.CENTER);
this.validate();
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setLayout(new java.awt.BorderLayout());
}// </editor-fold>
}
It does not show the chart when I add this panel to a jFrame.
I'm pretty confident that the problem is lie within the jPanel implementation.
Can someone give me some pointer. (Other panels does not seem to have a problem until now)