1 37 38 package org.jfree.chart.demo; 39 40 import java.awt.Color ; 41 import java.awt.GradientPaint ; 42 43 import org.jfree.chart.ChartFactory; 44 import org.jfree.chart.ChartPanel; 45 import org.jfree.chart.JFreeChart; 46 import org.jfree.data.WindDataset; 47 import org.jfree.ui.ApplicationFrame; 48 import org.jfree.ui.RefineryUtilities; 49 50 55 public class WindChartDemo extends ApplicationFrame { 56 57 62 public WindChartDemo(String title) { 63 64 super(title); 65 66 WindDataset dataset = DemoDatasetFactory.createWindDataset1(); 67 68 JFreeChart chart = createChart(dataset); 70 71 ChartPanel chartPanel = new ChartPanel(chart); 73 chartPanel.setPreferredSize(new java.awt.Dimension (500, 270)); 74 setContentPane(chartPanel); 75 76 } 77 78 85 private JFreeChart createChart(WindDataset dataset) { 86 87 JFreeChart chart = ChartFactory.createWindPlot( 88 "Wind Chart Demo", 89 "Date", 90 "Direction / Force", 91 dataset, 92 true, 93 false, 94 false 95 ); 96 97 chart.setBackgroundPaint(new GradientPaint (0, 0, Color.white, 1000, 0, Color.green)); 99 return chart; 100 101 } 102 103 114 119 public static void main(String [] args) { 120 121 WindChartDemo demo = new WindChartDemo("Wind Chart Demo"); 122 demo.pack(); 123 RefineryUtilities.centerFrameOnScreen(demo); 124 demo.setVisible(true); 125 126 } 127 128 } 129 | Popular Tags |