import org.jfree.chart.JFreeChart; import org.jfree.chart.ChartFactory; import org.jfree.data.xy.MatrixSeriesCollection; import org.jfree.data.xy.MatrixSeries; import org.jfree.chart.plot.PlotOrientation; import javax.swing.JFrame; import java.awt.BorderLayout; import org.jfree.chart.ChartPanel; public class Test2_1 extends JFrame{ public static void main(String[] args) { Test2_1 frame = new Test2_1(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(10, 10, 500, 500); frame.setTitle("グラフサンプル"); frame.setVisible(true); } Test2_1(){ MatrixSeriesCollection data = new MatrixSeriesCollection(); JFreeChart chart = ChartFactory.createBubbleChart("収益分析", "ページ数", "更新頻度", createData(), PlotOrientation.VERTICAL, true, false, false); ChartPanel cpanel = new ChartPanel(chart); getContentPane().add(cpanel, BorderLayout.CENTER); } private MatrixSeriesCollection createData(){ MatrixSeriesCollection data = new MatrixSeriesCollection(); MatrixSeries series = new MatrixSeries("物販", 20, 20); series.update(16, 14, 8d); series.update(13, 16, 4d); series.update(4, 4, 3d); series.update(5, 16, 6d); series.update(12, 6, 4d); data.addSeries(series); return data; } }