1 39 40 package org.jfree.chart.demo; 41 42 import org.jfree.chart.ChartFactory; 43 import org.jfree.chart.ChartPanel; 44 import org.jfree.chart.JFreeChart; 45 import org.jfree.chart.axis.NumberAxis; 46 import org.jfree.chart.plot.PlotOrientation; 47 import org.jfree.data.XYDataset; 48 import org.jfree.data.XYSeries; 49 import org.jfree.data.XYSeriesCollection; 50 import org.jfree.ui.ApplicationFrame; 51 import org.jfree.ui.RefineryUtilities; 52 53 58 public class ScatterPlotDemo3 extends ApplicationFrame { 59 60 65 public ScatterPlotDemo3(String title) { 66 67 super(title); 68 XYSeries series = new XYSeries("Test Data"); 69 series.add(0.058333333333333334, 18.251567840576172); 70 series.add(0.06666666666666667, 18.32216453552246); 71 series.add(0.09166666666666666, 2.476291662324533E26); series.add(0.1, 18.553701400756836); 73 series.add(0.10833333333333334, 18.60835838317871); 74 series.add(0.11666666666666667, 18.66070556640625); 75 XYDataset data = new XYSeriesCollection(series); 76 JFreeChart chart = ChartFactory.createScatterPlot( 77 "Scatter Plot Demo 3", 78 "X", "Y", 79 data, 80 PlotOrientation.VERTICAL, 81 true, 82 true, 83 false 84 ); 85 NumberAxis domainAxis = (NumberAxis) chart.getXYPlot().getDomainAxis(); 86 domainAxis.setAutoRangeIncludesZero(false); 87 ChartPanel chartPanel = new ChartPanel(chart); 88 setContentPane(chartPanel); 89 90 } 91 92 103 108 public static void main(String [] args) { 109 110 ScatterPlotDemo3 demo = new ScatterPlotDemo3("Scatter Plot Demo 3"); 111 demo.pack(); 112 RefineryUtilities.centerFrameOnScreen(demo); 113 demo.setVisible(true); 114 115 } 116 117 } 118 | Popular Tags |