List of usage examples for org.jfree.chart ChartFrame ChartFrame
public ChartFrame(String title, JFreeChart chart)
From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) { dataSet.setValue(carList.getTyrePressure(), "Tyre Pressure", carList.getTimestamp()); }/* w w w. j a v a 2s.co m*/ JFreeChart chart = ChartFactory.createBarChart("Tyre Pressure", "Timestamp", "Tyre Pressure", dataSet, PlotOrientation.HORIZONTAL.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLACK); ChartFrame frame = new ChartFrame("TYRE PRESSURE GRAPH", chart); frame.setVisible(true); frame.setSize(600, 600); // TODO add your handling code here: }
From source file:userInterface.doctor.ReportingPatientVitalHistJPanel.java
private void respJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_respJButtonActionPerformed DefaultTableModel dtm = (DefaultTableModel) vitalJTable.getModel(); DefaultCategoryDataset respBarChartSet = new DefaultCategoryDataset(); for (VitalSignInfo vhl : patient.getVitalHistory().getVitalHistory()) { respBarChartSet.setValue(vhl.getRespRate(), "Resp rate", vhl.getCurrentTime()); }/* www .j a v a 2 s. c om*/ JFreeChart respChart = ChartFactory.createBarChart3D("Vital History", "Time", "Resp Rate", respBarChartSet, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = respChart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartFrame frame = new ChartFrame("Bar Chart for Respiratory Vital Sign", respChart); frame.setVisible(true); frame.setSize(450, 350); }
From source file:UserInterface.AdminWorkArea.InventoryUsageJPanel.java
private void usageJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_usageJButtonActionPerformed DefaultTableModel dtm = (DefaultTableModel) deviceUsageJTable.getModel(); int rows = dtm.getRowCount(); DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); for (int i = 0; i < rows; i++) { int num = (int) deviceUsageJTable.getValueAt(i, 1); dataSet.setValue(num, "Number Of Reservations", String.valueOf(deviceUsageJTable.getValueAt(i, 0))); }/*from w w w . j a va 2s .com*/ JFreeChart chart = ChartFactory.createBarChart("Device Usage Chart", "Device Name", "Number of Reservations", dataSet, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinePaint(Color.BLACK); ChartFrame frame = new ChartFrame("Sales Overview", chart); frame.setVisible(true); frame.setSize(600, 600); }
From source file:library.ChartGUI.java
private void btBar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btBar1ActionPerformed try {//from w ww . j a va2 s . c om // TODO add your handling code here: JDBCCategoryDataset dataset = new JDBCCategoryDataset(da.getConnection(), sql0); JFreeChart chart = ChartFactory.createBarChart3D("Sum Brought Books", "Month", "Count", dataset, PlotOrientation.VERTICAL, false, true, true); BarRenderer renderer = null; CategoryPlot plot = null; renderer = new BarRenderer(); ChartFrame frame = new ChartFrame("Sum Brought Books Chart", chart); frame.setVisible(true); frame.setSize(1250, 700); frame.setResizable(false); } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex); } }
From source file:tusys.view.jPanelStatistik.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed jenis_kegiatan = jComboBox1.getSelectedItem().toString(); System.out.println(jenis_kegiatan); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try {//www . jav a2 s .c o m tanggal_mulai = new java.sql.Date(sdf.parse(jTextFieldTanggalMulai.getText()).getTime()); tanggal_selesai = new java.sql.Date(sdf.parse(jTextFieldTanggalSelesai.getText()).getTime()); if (tanggal_mulai.after(tanggal_selesai)) { JOptionPane.showMessageDialog(null, "tanggal mulai harus sebelum tanggal selesai"); return; } } catch (ParseException ex) { JOptionPane.showMessageDialog(null, "Format tanggal masukan salah"); return; //Logger.getLogger(jPanelStatistik.class.getName()).log(Level.SEVERE, null, ex); } if (jenis_kegiatan.equals("Semua")) { try { stat = mainMenu.getDbc().getAllStatistic(tanggal_mulai, tanggal_selesai); } catch (SQLException ex) { Logger.getLogger(jPanelStatistik.class.getName()).log(Level.SEVERE, null, ex); } } else { try { stat = mainMenu.getDbc().getStatistic(jenis_kegiatan, (tanggal_mulai), (tanggal_selesai)); } catch (SQLException ex) { Logger.getLogger(jPanelStatistik.class.getName()).log(Level.SEVERE, null, ex); } } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < stat.getRuangan().size(); i++) { dataset.setValue(stat.getFrekuensi().get(i), "Frekuensi", stat.getRuangan().get(i)); } JFreeChart chart = ChartFactory.createBarChart("Statistik Penggunaan Ruangan", "Ruangan", "Frekuensi", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLACK); ValueAxis yAxis = chart.getCategoryPlot().getRangeAxis(); yAxis.setRange(0.0, 100.0); p.setRangeAxis(yAxis); ChartFrame frame = new ChartFrame("Statistik", chart); frame.setVisible(true); frame.setLocation(500, 200); frame.setSize(565, 410); /* //masih ga keluar gambarnya ChartPanel cp = new ChartPanel(chart); jPanel1.removeAll(); jPanel1.add(cp,BorderLayout.CENTER); jPanel1.revalidate(); mainMenu.getjPanelData1().add(jPanel1); */ }
From source file:UserInterfaces.HAdministration.ReportDataJPanel.java
private void sourcejButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sourcejButton1ActionPerformed // TODO add your handling code here: int firsthandnumber = 0; int secondhandnumber = 0; // int workrequestSize = organization.getWorkQueue().getWorkRequestList().size(); // WorkRequest lastRequest = organization.getWorkQueue().getWorkRequestList().get(workrequestSize - 1); for (WorkRequest workRequest : organization.getWorkQueue().getWorkRequestList()) { if (workRequest.getSource().toString().equals(Source.FIRST)) { firsthandnumber = firsthandnumber + 1; }/* www . ja va 2s . c om*/ if (workRequest.getSource().toString().equals(Source.SECOND)) { secondhandnumber = secondhandnumber + 1; } } ReportToReporter report = organization.getReport(); report.setFirsthandsource(firsthandnumber); report.setSecondhandsource(secondhandnumber); report.setStatus("success"); DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("First hand", firsthandnumber); dataset.setValue("Second hand", secondhandnumber); JFreeChart chart = ChartFactory.createPieChart("Source of Reports", dataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); ChartFrame chartFrame = new ChartFrame("Source of Reports", chart); chartFrame.setSize(450, 550); chartFrame.setVisible(true); for (Network network : es.getNetworkList()) { for (Enterprise e : network.getEd().getEnterprisesList()) { if (e.getOrgName().equals(enterprise.getOrgName())) { for (Enterprise en : network.getEd().getEnterprisesList()) { if (en instanceof HospitalEnterprise || en instanceof ClinicEnterprise) { en.setReport(report); } } } } } }
From source file:UserInterface.AdministrativeRole.ReportsJPanel.java
private void ReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ReportActionPerformed // TODO add your handling code here: int countBad = 0; int countGood = 0; int countExcellent = 0; for (Organization organization : enterprise.getOrganizationDirectory().getOrganizationList()) { if (organization instanceof AdminOrganization) { for (FarmerFeedbackWorkRequest request : organization.getFeedbackWorkQueue() .getFarmerFeedbackList()) { if (request.getOverallRating().equalsIgnoreCase("Bad")) { countBad++;/*w ww . j a v a2 s.c o m*/ } else if (request.getOverallRating().equalsIgnoreCase("Good")) { countGood++; } else if (request.getOverallRating().equalsIgnoreCase("Excellent")) { countExcellent++; } } break; } } float total = countBad + countGood + countExcellent; float pGood = (countGood / total) * 100; float pBad = (countBad / total) * 100; float pExcellent = (countExcellent / total) * 100; DefaultPieDataset pieDataSet = new DefaultPieDataset(); pieDataSet.setValue("Bad%: " + pBad, pGood); pieDataSet.setValue("Good%: " + pGood, pBad); pieDataSet.setValue("Excellent%: " + pExcellent, pExcellent); JFreeChart chart = ChartFactory.createPieChart("Overall Application Rating", pieDataSet, true, true, true); PiePlot plot = (PiePlot) chart.getPlot(); ChartFrame frame = new ChartFrame("Overall Application Rating", chart); frame.setVisible(true); frame.setSize(500, 500); }
From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) { dataSet.setValue(carList.getPollutionLevel(), "Pollution", carList.getTimestamp()); }//from ww w. j a va 2s. c o m JFreeChart chart = ChartFactory.createBarChart("Pollution", "Timestamp", "Pollution", dataSet, PlotOrientation.HORIZONTAL.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLACK); ChartFrame frame = new ChartFrame("POLLUTION GRAPH", chart); frame.setVisible(true); frame.setSize(600, 600); // TODO add your handling code here: }
From source file:swing.PrincipalMDI.java
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed // TODO add your handling code here: DefaultCategoryDataset barDataSet = new DefaultCategoryDataset(); barDataSet.setValue(cptAttente, "ticket", "En attente"); barDataSet.setValue(cptEnCours, "ticket", "En cours"); barDataSet.setValue(cptNonAttribue, "ticket", "Non attribu"); barDataSet.setValue(cptResolu, "ticket", "Resolu"); barDataSet.setValue(cptATraiter, "ticket", "A traiter"); JFreeChart chart = ChartFactory.createBarChart3D("Camembert", "Bar", "Ticket", barDataSet, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinePaint(Color.blue); ChartFrame frame = new ChartFrame("Bar", chart); frame.setVisible(true);//from ww w . j a va 2s .co m frame.setSize(600, 500); }
From source file:userInterface.doctor.ReportingPatientVitalHistJPanel.java
private void heartJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_heartJButtonActionPerformed // TODO add your handling code here: DefaultTableModel dtm = (DefaultTableModel) vitalJTable.getModel(); DefaultCategoryDataset heartBarChartSet = new DefaultCategoryDataset(); for (VitalSignInfo vhl : patient.getVitalHistory().getVitalHistory()) { heartBarChartSet.setValue(vhl.getHeartRate(), "Heart rate", vhl.getCurrentTime()); }//from w w w . j a v a 2s .c o m JFreeChart respChart = ChartFactory.createBarChart3D("Vital History", "Time", "Heart Rate", heartBarChartSet, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = respChart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartFrame frame = new ChartFrame("Bar Chart for Heart rate Vital Information", respChart); frame.setVisible(true); frame.setSize(450, 350); }