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.axis.DateAxis; 44 import org.jfree.chart.axis.DateTickMarkPosition; 45 import org.jfree.data.HighLowDataset; 46 import org.jfree.ui.ApplicationFrame; 47 import org.jfree.ui.RefineryUtilities; 48 49 54 public class HighLowChartDemo extends ApplicationFrame { 55 56 61 public HighLowChartDemo(String title) { 62 63 super(title); 64 65 HighLowDataset dataset = DemoDatasetFactory.createHighLowDataset(); 66 JFreeChart chart = ChartFactory.createHighLowChart("High-Low-Open-Close Demo", 67 "Time", "Value", 68 dataset, true); 69 DateAxis axis = (DateAxis) chart.getXYPlot().getDomainAxis(); 70 axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); 71 ChartPanel chartPanel = new ChartPanel(chart); 72 chartPanel.setPreferredSize(new java.awt.Dimension (500, 270)); 73 setContentPane(chartPanel); 74 75 } 76 77 88 93 public static void main(String [] args) { 94 95 HighLowChartDemo demo = new HighLowChartDemo("High-Low-Open-Close Demo"); 96 demo.pack(); 97 RefineryUtilities.centerFrameOnScreen(demo); 98 demo.setVisible(true); 99 100 } 101 102 } 103 | Popular Tags |