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.StandardTickUnitSource; 44 import org.jfree.chart.plot.PlotOrientation; 45 import org.jfree.chart.plot.XYPlot; 46 import org.jfree.data.XYSeries; 47 import org.jfree.data.XYSeriesCollection; 48 import org.jfree.ui.ApplicationFrame; 49 import org.jfree.ui.RefineryUtilities; 50 51 56 public class SmallNumberDemo extends ApplicationFrame { 57 58 63 public SmallNumberDemo(String title) { 64 65 super(title); 66 XYSeries series = new XYSeries("Small Numbers"); 67 series.add(1.0E-5, 1.0E-16); 68 series.add(5.0E-5, 2.0E-12); 69 series.add(17.3E-5, 5.0E-7); 70 series.add(21.2E-5, 9.0E-6); 71 XYSeriesCollection data = new XYSeriesCollection(series); 72 JFreeChart chart = ChartFactory.createXYLineChart( 73 "Small Number Demo", 74 "X", 75 "Y", 76 data, 77 PlotOrientation.VERTICAL, 78 true, 79 true, 80 false 81 ); 82 XYPlot plot = chart.getXYPlot(); 83 plot.getDomainAxis().setStandardTickUnits(new StandardTickUnitSource()); 84 plot.getRangeAxis().setStandardTickUnits(new StandardTickUnitSource()); 85 86 ChartPanel chartPanel = new ChartPanel(chart); 87 chartPanel.setPreferredSize(new java.awt.Dimension (500, 270)); 88 setContentPane(chartPanel); 89 90 } 91 92 103 108 public static void main(String [] args) { 109 110 System.out.println("Min Double: " + Double.MIN_VALUE); 111 SmallNumberDemo demo = new SmallNumberDemo("Small Number Demo"); 112 demo.pack(); 113 RefineryUtilities.centerFrameOnScreen(demo); 114 demo.setVisible(true); 115 116 } 117 118 } 119 | Popular Tags |