List of usage examples for org.jfree.chart ChartFrame setSize
public void setSize(int width, int height)
The width and height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .
From source file:recyclingsimulationUI.MainFrame.java
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed // TODO add your handling code here: DbConnect conn = new DbConnect(); ArrayList<String> name_array = new ArrayList<String>(); ArrayList<String> count_array = new ArrayList<String>(); try {// ww w . j av a2s. co m String totalCount = conn.getTotalCountOfTransacations(); Object[] name_and_count_array = new Object[10]; name_and_count_array = conn.getTransactionDetailsCount(); name_array = (ArrayList<String>) name_and_count_array[0]; count_array = (ArrayList<String>) name_and_count_array[1]; } catch (SQLException ex) { Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); } for (int i = 0; i < name_array.size(); i++) { System.out.print(name_array.get(i)); } DefaultPieDataset dp = new DefaultPieDataset(); for (int i = 0; i < name_array.size(); i++) { dp.setValue(name_array.get(i), Integer.parseInt(count_array.get(i))); } JFreeChart pieChart = ChartFactory.createPieChart("Pie chart representing usage of each RCM", dp, true, true, false); PiePlot p = (PiePlot) pieChart.getPlot(); ChartFrame cf = new ChartFrame("Pie Chart", pieChart); cf.setVisible(true); cf.setSize(750, 500); }
From source file:FirstStatMain.java
private void stpiechartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stpiechartActionPerformed String sql = "select English,Science,Social,Math from Marks_info where Studentid=?"; try {/* ww w . j a va2 s . c om*/ pst = connection.prepareStatement(sql); pst.setString(1, txtStudentId.getText()); rst = pst.executeQuery(); DefaultPieDataset dataset = new DefaultPieDataset(); while (rst.next()) { dataset.setValue("English", Integer.parseInt(rst.getString("English"))); dataset.setValue("Science", Integer.parseInt(rst.getString("Science"))); dataset.setValue("Social", Integer.parseInt(rst.getString("Social"))); dataset.setValue("Math", Integer.parseInt(rst.getString("Math"))); } JFreeChart pchart = ChartFactory.createPieChart("Pie Chart", dataset, true, true, true); PiePlot P = (PiePlot) pchart.getPlot(); ChartFrame cf = new ChartFrame("Pie Chart", pchart); cf.setSize(450, 450); cf.setVisible(true); } catch (SQLException ex) { JOptionPane.showMessageDialog(rootPane, ex); } }
From source file:FirstStatMain.java
private void allstpiechartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allstpiechartActionPerformed String sql = "select Studentid,Total from Marks_info"; try {//from www. j a va2 s .com pst = connection.prepareStatement(sql); //pst.setString(1, txtStudentId.getText()); rst = pst.executeQuery(); DefaultPieDataset dataset = new DefaultPieDataset(); while (rst.next()) { dataset.setValue(rst.getString("Studentid"), Integer.parseInt(rst.getString("Total"))); //dataset.setValue(rst.getString("Studentid"),Integer.parseInt(rst.getString("Science"))); //dataset.setValue(rst.getString("Studentid"),Integer.parseInt(rst.getString("Social"))); //dataset.setValue(rst.getString("Studentid"),Integer.parseInt(rst.getString("Math"))); } JFreeChart pchart = ChartFactory.createPieChart("Pie Chart", dataset, true, true, true); PiePlot P = (PiePlot) pchart.getPlot(); ChartFrame cf = new ChartFrame("Pie Chart", pchart); cf.setSize(450, 450); cf.setVisible(true); } catch (SQLException ex) { JOptionPane.showMessageDialog(rootPane, ex); } }
From source file:FirstStatMain.java
private void stbarchartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stbarchartActionPerformed String sql = "select Studentid,English,Science,Social,Math from Marks_info where Studentid=?"; try {/*from w w w. ja va 2 s .c o m*/ pst = connection.prepareStatement(sql); pst.setString(1, txtStudentId.getText()); rst = pst.executeQuery(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); while (rst.next()) { dataset.setValue(Integer.parseInt(rst.getString("English")), rst.getString("Studentid"), "English"); dataset.setValue(Integer.parseInt(rst.getString("Science")), rst.getString("Studentid"), "Science"); dataset.setValue(Integer.parseInt(rst.getString("Social")), rst.getString("Studentid"), "Social"); dataset.setValue(Integer.parseInt(rst.getString("Math")), rst.getString("Studentid"), "Math"); } JFreeChart pchart = ChartFactory.createBarChart("Bar Chart", "Subject", "Marks", dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot P = (CategoryPlot) pchart.getCategoryPlot(); P.setRangeGridlinePaint(Color.BLACK); ChartFrame cf = new ChartFrame("Bar Chart", pchart); cf.setSize(450, 450); cf.setVisible(true); } catch (SQLException ex) { JOptionPane.showMessageDialog(rootPane, ex); } }
From source file:FirstStatMain.java
private void allstbarchartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allstbarchartActionPerformed String sql = "select Studentid,English,Science,Social,Math from Marks_info"; try {/*from w w w . j a v a2 s .c o m*/ pst = connection.prepareStatement(sql); //pst.setString(1, txtStudentId.getText()); rst = pst.executeQuery(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); while (rst.next()) { dataset.setValue(Integer.parseInt(rst.getString("English")), rst.getString("Studentid"), "English"); dataset.setValue(Integer.parseInt(rst.getString("Science")), rst.getString("Studentid"), "Science"); dataset.setValue(Integer.parseInt(rst.getString("Social")), rst.getString("Studentid"), "Social"); dataset.setValue(Integer.parseInt(rst.getString("Math")), rst.getString("Studentid"), "Math"); } JFreeChart pchart = ChartFactory.createBarChart("Bar Chart", "Subject", "Marks", dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot P = (CategoryPlot) pchart.getCategoryPlot(); P.setRangeGridlinePaint(Color.BLACK); ChartFrame cf = new ChartFrame("Bar Chart", pchart); cf.setSize(450, 450); cf.setVisible(true); } catch (SQLException ex) { JOptionPane.showMessageDialog(rootPane, ex); } }
From source file:FirstStatMain.java
private void stlinechartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stlinechartActionPerformed String sql = "select Studentid,English,Science,Social,Math from Marks_info where Studentid=?"; try {/*from ww w . j a v a2 s . co m*/ pst = connection.prepareStatement(sql); pst.setString(1, txtStudentId.getText()); rst = pst.executeQuery(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); while (rst.next()) { dataset.setValue(Integer.parseInt(rst.getString("English")), rst.getString("Studentid"), "English"); dataset.setValue(Integer.parseInt(rst.getString("Science")), rst.getString("Studentid"), "Science"); dataset.setValue(Integer.parseInt(rst.getString("Social")), rst.getString("Studentid"), "Social"); dataset.setValue(Integer.parseInt(rst.getString("Math")), rst.getString("Studentid"), "Math"); } JFreeChart pchart = ChartFactory.createLineChart("Line Chart", "Subject", "Marks", dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot P = (CategoryPlot) pchart.getCategoryPlot(); P.setRangeGridlinePaint(Color.BLACK); ChartFrame cf = new ChartFrame("Line Chart", pchart); cf.setSize(450, 450); cf.setVisible(true); } catch (SQLException ex) { JOptionPane.showMessageDialog(rootPane, ex); } }
From source file:FirstStatMain.java
private void allstLinechartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allstLinechartActionPerformed String sql = "select Studentid,English,Science,Social,Math from Marks_info"; try {/* w w w . ja v a 2 s .c o m*/ pst = connection.prepareStatement(sql); //pst.setString(1, txtStudentId.getText()); rst = pst.executeQuery(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); while (rst.next()) { dataset.setValue(Integer.parseInt(rst.getString("English")), rst.getString("Studentid"), "English"); dataset.setValue(Integer.parseInt(rst.getString("Science")), rst.getString("Studentid"), "Science"); dataset.setValue(Integer.parseInt(rst.getString("Social")), rst.getString("Studentid"), "Social"); dataset.setValue(Integer.parseInt(rst.getString("Math")), rst.getString("Studentid"), "Math"); } JFreeChart pchart = ChartFactory.createLineChart("Line Chart", "Subject", "Marks", dataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot P = (CategoryPlot) pchart.getCategoryPlot(); P.setRangeGridlinePaint(Color.BLACK); ChartFrame cf = new ChartFrame("Line Chart", pchart); cf.setSize(450, 450); cf.setVisible(true); } catch (SQLException ex) { JOptionPane.showMessageDialog(rootPane, ex); } }
From source file:ecorecyclesimulator.RmosGUI.java
void getStat() { DbConnect conn = new DbConnect(); ArrayList<String> name_array = new ArrayList<String>(); ArrayList<String> count_array = new ArrayList<String>(); try {/*from w w w . j av a 2 s .c o m*/ String totalCount = conn.noOFTransactions(); Object[] name_and_count_array = new Object[10]; name_and_count_array = conn.getDetails(); name_array = (ArrayList<String>) name_and_count_array[0]; count_array = (ArrayList<String>) name_and_count_array[1]; } catch (SQLException ex) { // Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); System.out.println("Exception" + ex); } JOptionPane.showMessageDialog(null, name_array.size()); for (int i = 0; i < name_array.size(); i++) { System.out.print(name_array.get(i)); } DefaultPieDataset dp = new DefaultPieDataset(); for (int i = 0; i < name_array.size(); i++) { dp.setValue(name_array.get(i), Integer.parseInt(count_array.get(i))); } JFreeChart pieChart = ChartFactory.createPieChart("Statistical representation of Usage of RCM", dp, true, true, false); PiePlot p = (PiePlot) pieChart.getPlot(); ChartFrame cf = new ChartFrame("Pie Chart", pieChart); cf.setVisible(true); cf.setSize(750, 500); }
From source file:view.QuestionLab.java
private void prograssButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prograssButtonActionPerformed int count1 = 0; int count2 = 0; int count3 = 0; int count4 = 0; int count5 = 0; int count6 = 0; int count7 = 0; int count8 = 0; int count9 = 0; int count10 = 0; int count11 = 0; int count12 = 0; int count13 = 0; int count14 = 0; int count15 = 0; int count16 = 0; int count17 = 0; int a1 = 0;//w w w .ja v a 2 s. com int a2 = 0; int a3 = 0; int a4 = 0; int a5 = 0; int a6 = 0; int a7 = 0; int a8 = 0; int a9 = 0; int a10 = 0; int a11 = 0; int a12 = 0; int a13 = 0; int a14 = 0; int a15 = 0; int a16 = 0; int a17 = 0; DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int is : answerMap.keySet()) { if (newMap.containsKey(is) && Objects.equals(answerMap.get(is), newMap.get(is))) { anxCount++; int myKey = is; if (myKey < 7) { count1++; a1 = (count1 * 100) / 6; System.out.println("Collection Framework Generics :" + a1); //System.out.println("Collection Framework Generics :" + a1); // dataset.setValue(a1, "gfdg", "Collection Framework Generics"); } else if (myKey < 8) { count2++; a2 = (count2 * 100) / 1; System.out.println("count 2 :" + a2); // dataset.setValue(a2, "gfdg", "Date Number Currency"); } else if (myKey < 12) { count3++; a3 = (count3 * 100) / 3; System.out.println("count 3 :" + a3); // dataset.setValue(a3, "gfdg", "Development"); } else if (myKey < 17) { count4++; a4 = (count4 * 100) / 5; System.out.println("count 4 :" + a4); //dataset.setValue(a4, "gfdg", "Exception Assertion"); } else if (myKey < 23) { count5++; a5 = (count5 * 100) / 6; System.out.println("count 5 :" + a5); //dataset.setValue(a5, "gfdg", "File IO , Serialization"); } else if (myKey < 24) { count6++; a6 = (count6 * 100) / 1; System.out.println("count 6 :" + a6); //dataset.setValue(a6, "gfdg", "Flow Control"); } else if (myKey < 27) { count7++; a7 = (count7 * 100) / 3; System.out.println("count 7 :" + a7); //dataset.setValue(a7, "gfdg", "Formatting Tokenizing"); } else if (myKey < 29) { count8++; a8 = (count8 * 100) / 2; System.out.println("count 8 :" + a8); //dataset.setValue(a8, "gfdg", "Garbage Collector"); } else if (myKey < 30) { count9++; a9 = (count9 * 100) / 1; System.out.println("count 9 :" + a9); //dataset.setValue(a9, "gfdg", "Inner Classes"); } else if (myKey < 34) { count10++; a10 = (count10 * 100) / 4; System.out.println("count 10 :" + a10); //dataset.setValue(a10, "gfdg", "Interface Var-Args Enum"); } else if (myKey < 35) { count11++; a11 = (count11 * 100) / 1; System.out.println("count 11 :" + a11); //dataset.setValue(a11, "gfdg", "Java Fundamentals, Primitive Data Types Arrays"); } else if (myKey < 38) { count12++; a12 = (count12 * 100) / 3; System.out.println("count 12 :" + a12); //dataset.setValue(a12, "gfdg", "Modifiers Access,Non Access"); } else if (myKey < 50) { count13++; a13 = (count13 * 100) / 12; System.out.println("count 13 :" + a13); //dataset.setValue(a13, "gfdg", "Object Orientation"); } else if (myKey < 53) { count14++; a14 = (count14 * 100) / 3; System.out.println("count 14 :" + a14); //dataset.setValue(a14, "gfdg", "Objects, Variable, Methods"); } else if (myKey < 55) { count15++; a15 = (count15 * 100) / 2; System.out.println("count 15 :" + a15); //dataset.setValue(a15, "gfdg", "String, String Buffer, String Builder"); } else if (myKey < 59) { count16++; a16 = (count16 * 100) / 4; System.out.println("count 16 :" + a16); //dataset.setValue(a16, "gfdg", "Threads"); } else if (myKey < 61) { count17++; a17 = (count17 * 100) / 2; System.out.println("count 17 :" + a17); //dataset.setValue(a17, "gfdg", "Wrapper Classes"); } System.out.println("keys :" + myKey); //JFreeChart chart=ChartFactory.create } } // JFreeChart freeChart = ChartFactory.createBarChart("Marks with catagories", "Subject", "Persentage", dataset, PlotOrientation.VERTICAL, false, true, false); // CategoryPlot plot = freeChart.getCategoryPlot(); //plot.setRangeGridlinePaint(Color.BLUE); // ChartFrame frame = new ChartFrame("Student Performance", freeChart); // frame.setVisible(true); // frame.setSize(550, 450); dataset.setValue(a1, "gfdg", "CollectionFramework,Generics"); dataset.setValue(a2, "gfdg", "Date,Num,Curr"); dataset.setValue(a3, "gfdg", "Development"); dataset.setValue(a4, "gfdg", "Exception"); dataset.setValue(a5, "gfdg", "File,Serialization"); dataset.setValue(a6, "gfdg", "Flow Control"); dataset.setValue(a7, "gfdg", "Tokenizing"); dataset.setValue(a8, "gfdg", "G.C"); dataset.setValue(a9, "gfdg", "Inner Classes"); dataset.setValue(a10, "gfdg", "Interface,Var-Args,Enum"); dataset.setValue(a11, "gfdg", "Fundamentals,Data Types,Arrays"); dataset.setValue(a12, "gfdg", "Modifiers"); dataset.setValue(a13, "gfdg", "OOP"); dataset.setValue(a14, "gfdg", "Objects,Variable,Methods"); dataset.setValue(a15, "gfdg", "String, String Buffer, String Builder"); dataset.setValue(a16, "gfdg", "Threads"); dataset.setValue(a17, "gfdg", "Wrapper Classes"); JFreeChart freeChart = ChartFactory.createBarChart("Marks with catagories", "Subject", "Persentage", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = freeChart.getCategoryPlot(); plot.setRangeGridlinePaint(Color.BLUE); ChartFrame frame = new ChartFrame("Student Performance", freeChart); frame.setVisible(true); frame.setSize(1500, 750); System.out.println("Correct :" + anxCount); System.out.println("Percentage :" + (anxCount * 100) / 60 + "%"); System.out.println("submit answers " + answerMap); System.out.println("correct answers " + newMap); try { controller.removeObserve(studentObserverImpl); } catch (RemoteException ex) { Logger.getLogger(QuestionLab.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:CampusSmartCafe.view.MainFrame2.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("One", new Integer(50)); pieDataset.setValue("Two", new Integer(20)); pieDataset.setValue("Three", new Integer(0)); pieDataset.setValue("Four", new Integer(50)); JFreeChart chart = ChartFactory.createPieChart("Pie Chart", pieDataset, true, true, true); PiePlot P = (PiePlot) chart.getPlot(); //P.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame frame = new ChartFrame("Pie Chart", chart); frame.setVisible(true);/*from ww w. j av a 2 s .co m*/ frame.setSize(450, 500);// TODO add your handling code here: }