日期:2014-05-20 浏览次数:20767 次
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { DefaultCategoryDataset DataSet = new DefaultCategoryDataset(); DataSet.addValue(300, "number", "apple"); DataSet.addValue(400, "number", "barara"); DataSet.addValue(250, "number", "pear"); DataSet.addValue(330, "number", "milk"); DataSet.addValue(420, "number", "cheese"); //创建柱形图 JFreeChart chart = ChartFactory.createBarChart3D("Catogram", "Fruit", "Sale", DataSet, PlotOrientation.VERTICAL, false, false, false); //用来放置图表 ChartPanel panel = new ChartPanel(chart); jPanel10.add(10); //jPanel10是我已经添加好的面板 }