001package bradleyross.opensource.jfreechart; 002import org.jfree.chart.ChartFactory; 003import org.jfree.chart.ChartFrame; 004import org.jfree.chart.JFreeChart; 005import org.jfree.data.general.DefaultPieDataset; 006/** Example of a pie chart from the installation notes. 007 * <p>This example was given in the installation notes 008 * that accompanied the files in the JFreeChart distribution.</p> 009 * 010 * @author Bradley Ross 011 * 012 */ 013public class First { 014 015 /** 016 * Create and display the chart. 017 * @param args - Parameters are not used by this program. 018 * @see ChartFactory 019 */ 020 public static void main(String[] args) { 021 DefaultPieDataset data = new DefaultPieDataset(); 022 data.setValue("Category 1", 43.2); 023 data.setValue("Category 2", 27.9); 024 data.setValue("Category 3", 79.5); 025 JFreeChart chart = ChartFactory.createPieChart( 026 "Sample Pie Chart", 027 data, 028 true, 029 true, 030 false 031 ); 032 ChartFrame frame = new ChartFrame("First", chart); 033 frame.pack(); 034 frame.setVisible(true); 035 } 036}