Currently I'm using JFreeChart 0.9.20, but I'm planning to upgrade as soon as I can be sure that I have atleast one working version.
As a simplified example, I have modified the piechart demo 7.
Could someone please explain what's wrong with this approach? All I see is a blank image.
Similar approach has worked with most of the other chart types.
Thank you in advance.
Code: Select all
package org.jfree.chart.demo;
import java.awt.*;
import javax.swing.JPanel;
import org.jfree.chart.*;
import org.jfree.chart.plot.*;
import org.jfree.data.DefaultPieDataset;
import org.jfree.ui.*;
public class PieChartDemo7 extends ApplicationFrame {
public PieChartDemo7(String title) {
super(title);
JPanel panel = new JPanel(new GridLayout());
DefaultPieDataset dataset = new DefaultPieDataset();
dataset.setValue("Section 1", 23.3);
dataset.setValue("Section 2", 56.5);
dataset.setValue("Section 3", 43.3);
dataset.setValue("Section 4", 11.1);
PiePlot singlePiePlot = new PiePlot();
((PiePlot)singlePiePlot).setDataset(((DefaultPieDataset)dataset));
JFreeChart currentPie = new JFreeChart(singlePiePlot);
// this part is in another file, that's why it's separated
Plot plot=new MultiplePiePlot();
((MultiplePiePlot)plot).setPieChart(currentPie);
JFreeChart chart1 = new JFreeChart(plot);
panel.add(new ChartPanel(chart1));
panel.setPreferredSize(new Dimension(800, 600));
setContentPane(panel);
}
public static void main(String[] args) {
PieChartDemo7 demo = new PieChartDemo7("Pie Chart Demo 7");
demo.pack();
RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
}
}