1 37 38 package org.jfree.chart.demo; 39 40 import org.jfree.chart.ChartFactory; 41 import org.jfree.chart.ChartPanel; 42 import org.jfree.chart.JFreeChart; 43 import org.jfree.chart.plot.PlotOrientation; 44 import org.jfree.chart.plot.XYPlot; 45 import org.jfree.data.XYDataset; 46 import org.jfree.ui.ApplicationFrame; 47 import org.jfree.ui.RefineryUtilities; 48 49 54 public class LineChartDemo4 extends ApplicationFrame { 55 56 61 public LineChartDemo4(String title) { 62 63 super(title); 64 65 XYDataset dataset = new SampleXYDataset(); 67 68 JFreeChart chart = ChartFactory.createXYLineChart( 70 "Line Chart Demo 4", "X", "Y", dataset, PlotOrientation.VERTICAL, 75 true, true, false ); 79 80 XYPlot plot = chart.getXYPlot(); 81 plot.getDomainAxis().setLowerMargin(0.0); 82 plot.getDomainAxis().setUpperMargin(0.0); 83 84 ChartPanel chartPanel = new ChartPanel(chart); 86 chartPanel.setPreferredSize(new java.awt.Dimension (500, 270)); 87 setContentPane(chartPanel); 88 89 } 90 91 102 107 public static void main(String [] args) { 108 109 LineChartDemo4 demo = new LineChartDemo4("Line Chart Demo 4"); 110 demo.pack(); 111 RefineryUtilities.centerFrameOnScreen(demo); 112 demo.setVisible(true); 113 114 } 115 116 } 117 | Popular Tags |