1 38 39 package org.jfree.chart.demo; 40 41 import javax.swing.JApplet ; 42 import javax.swing.JTabbedPane ; 43 44 import org.jfree.chart.ChartFactory; 45 import org.jfree.chart.ChartPanel; 46 import org.jfree.chart.JFreeChart; 47 import org.jfree.chart.plot.PlotOrientation; 48 import org.jfree.data.CategoryDataset; 49 import org.jfree.data.XYDataset; 50 51 56 public class JFreeChartAppletDemo extends JApplet { 57 58 61 public JFreeChartAppletDemo() { 62 63 JTabbedPane tabs = new JTabbedPane (); 64 65 XYDataset data1 = DemoDatasetFactory.createTimeSeriesCollection1(); 66 JFreeChart chart1 = ChartFactory.createTimeSeriesChart( 67 "Time Series", 68 "Date", 69 "Rate", 70 data1, 71 true, 72 true, 73 false 74 ); 75 ChartPanel panel1 = new ChartPanel( 76 chart1, 400, 300, 200, 100, 400, 200, 77 true, false, false, false, true, true 78 ); 79 tabs.add("Chart 1", panel1); 80 81 CategoryDataset data2 = DemoDatasetFactory.createCategoryDataset(); 82 JFreeChart chart2 = ChartFactory.createBarChart( 83 "Bar Chart", 84 "Categories", 85 "Value", 86 data2, 87 PlotOrientation.HORIZONTAL, 88 true, 89 true, 90 false 91 ); 92 ChartPanel panel2 = new ChartPanel( 93 chart2, 400, 300, 200, 100, 400, 200, 94 true, false, false, false, true, true 95 ); 96 tabs.add("Chart 2", panel2); 97 98 getContentPane().add(tabs); 99 100 } 101 102 } 103 | Popular Tags |