Java Programming - Can't make the chart visible!
Hi everyone ,
I 've been trying to understand JFreeChart and i have an applet with user interface and in the applet i have a JPanel name panel1... I init the dataset and in a function like DrawChart i called the dataset and try to draw the chart , like :
publicvoid DrawChart(){
initDataSet();
// create the chart...
JFreeChart chart = ChartFactory.createBarChart(
"Bar Chart",// chart title
"Category",// domain axis label
"Value",// range axis label
dataset,// data
PlotOrientation.VERTICAL,// orientation
true,// include legend
true,// tooltips?
false// URLs?
);
chartPanel =new ChartPanel(chart);
chartPanel.setPreferredSize(new Dimension(panel1.getHeight(),panel1.getWidth()));
panel1.add(chartPanel);
JOptionPane.showMessageDialog( null,""+panel1.getComponentCount());
panel1.validate();
panel1.repaint();
}
and in my initComponents() function i call the DrawChart and as having an appleti don't have main andi don't have frame- instead i use jpanel- ... Anything i've done i couldn't make the chart visible...
Can anyone help me?
Can't we use jpanel to contain jfreechart?

