List of usage examples for org.jfree.chart ChartFrame ChartFrame
public ChartFrame(String title, JFreeChart chart)
From source file:info.financialecology.finance.utilities.datastruct.VersatileChart.java
public void drawSimpleHistogram(VersatileTimeSeries ats) { ArrayList<VersatileTimeSeries> atsArray = new ArrayList<VersatileTimeSeries>(); atsArray.add(ats);//from w ww.j a v a 2s. co m JFreeChart chart = drawSimpleHistogram((String) ats.getKey(), atsArray); ChartFrame frame = new ChartFrame("UNKNOWN", chart); frame.pack(); frame.setVisible(true); }
From source file:dumbara.view.Chart1.java
public static void paymentHistory() { DefaultCategoryDataset objDataset = new DefaultCategoryDataset(); try {//ww w . ja v a 2 s . c om LoanSettle[] loanSettles = LoanSettleController.viewLoanSettle(); for (LoanSettle loanSettle : loanSettles) { objDataset.setValue(Double.parseDouble(loanSettle.getPayment()), "Loan Payments", loanSettle.getLoanSettleID()); } } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(Chart1.class.getName()).log(Level.SEVERE, null, ex); } // JFreeChart objChart = ChartFactory.createBarChart("Sales Comparisson", "Sales ID", "Sales Income", objDataset, PlotOrientation.VERTICAL, true, true, false); ChartFrame frame = new ChartFrame("Data Analysis Wizard - v2.1.4", objChart); frame.pack(); frame.setSize(1000, 600); frame.setVisible(true); frame.setLocationRelativeTo(null); }
From source file:pidev.presentation.Statistiques.java
private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed String requete = "select Count(id_Agence) from Agence "; System.out.println(requete);/*from w w w .ja va2 s . c om*/ try { Statement statement = MyConnection.getInstance().createStatement(); ResultSet resultat = statement.executeQuery(requete); while (resultat.next()) { nombredagence = resultat.getInt(1); } } catch (SQLException ex) { //Logger.getLogger(PersonneDao.class.getName()).log(Level.SEVERE, null, ex); System.out.println("erreur lors du chargement des annonces " + ex.getMessage()); } String requete2 = "select Count(id_Client) from Client "; System.out.println(requete2); try { Statement statement = MyConnection.getInstance().createStatement(); ResultSet resultat = statement.executeQuery(requete2); while (resultat.next()) { nombreclient = resultat.getInt(1); } } catch (SQLException ex) { //Logger.getLogger(PersonneDao.class.getName()).log(Level.SEVERE, null, ex); System.out.println("erreur lors du chargement des annonces " + ex.getMessage()); } DefaultPieDataset result = new DefaultPieDataset(); result.setValue("Agences", nombredagence); result.setValue("Clients", nombreclient); JFreeChart chart = ChartFactory.createPieChart3D("nombre d'agences + nombre de clients", result, true, true, false); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setStartAngle(290); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(0.5f); ChartFrame ch = new ChartFrame("Statistiques", chart); // ChartPanel ch = new ChartPanel(chart); ch.setSize(300, 300); ch.setLocationRelativeTo(null); ch.pack(); ch.setVisible(true); }
From source file:com.dnsoft.inmobiliaria.controllers.ConsultaCCPropietariosController.java
void muestraGrafico() { DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); //DefaultPieDataset dataDolares = new DefaultPieDataset(); for (Propietario propietario : listPropietarios) { CCPropietario ccPesos = cCPropietarioDAO.findUltimoMovimiento(Moneda.PESOS, propietario); if (ccPesos != null) { dataSet.setValue(ccPesos.getSaldo(), "Pesos", propietario.toString()); }//w ww . j ava 2 s. c om CCPropietario ccDolares = cCPropietarioDAO.findUltimoMovimiento(Moneda.DOLARES, propietario); if (ccDolares != null) { dataSet.setValue(ccDolares.getSaldo(), "Dolares", propietario.toString()); } } // Creando el Grafico //JFreeChart chart = ChartFactory.createPieChart("Saldos", (PieDataset) dataSet, true, true, false); JFreeChart chart = ChartFactory.createMultiplePieChart("Saldos", dataSet, TableOrder.BY_ROW, false, true, false); //PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot(); JFreeChart subchart = plot.getPieChart(); PiePlot p = (PiePlot) subchart.getPlot(); p.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}: {1} ({2})")); //JFreeChart chartDolares = ChartFactory.createPieChart("Saldos en Dolares", dataDolares, true, true, false); // Mostrar Grafico ChartFrame frame = new ChartFrame("JFreeChart", chart); frame.pack(); frame.setVisible(true); }
From source file:com.deafgoat.ml.prognosticator.Charter.java
/** * Shows the given chart/*from w w w . j a v a 2s.co m*/ * * @param name * The name to save the chart as * @param chart * The chart to draw */ private void drawChart(String name, JFreeChart chart) { _logger.info("Plotting p.d. chart for " + name); ChartFrame frame = new ChartFrame(name, chart); RefineryUtilities.centerFrameOnScreen(frame); frame.pack(); frame.setVisible(true); }
From source file:org.jboss.console.manager.interfaces.impl.GraphMBeanAttributeAction.java
public void doAction(TreeContext tc, AppletBrowser applet) { try {//from ww w. j av a 2s . c o m if (frame == null) { //tc.getRemoteMBeanInvoker ().invoke(targetObjectName, actionName, params, signature); dataset = new MBeanXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart("JMX Attribute: " + attr, "count", attr, dataset, PlotOrientation.VERTICAL, true, true, false); UpdateThread update = new UpdateThread(dataset, tc); Thread thread = new Thread(update); thread.start(); frame = new ChartFrame("JMX Attribute: " + attr, chart); frame.getChartPanel().setPreferredSize(new java.awt.Dimension(500, 270)); frame.pack(); } else { dataset.clear(); } frame.show(); frame.requestFocus(); } catch (Exception displayed) { displayed.printStackTrace(); } }
From source file:sms.Reports.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try {/*w w w . j a va 2s .c o m*/ methods m = new methods(); String query = "SELECT updated_at ,(maths+eng+chem+phy+geo+hist+bio+agri+bs+kiswa+cre)/11 FROM exam WHERE year='" + 1 + "'"; JDBCCategoryDataset dataset = new JDBCCategoryDataset(m.getConnection(), query); JFreeChart chart = ChartFactory.createBarChart("QUR", "year", "maths", dataset, PlotOrientation.VERTICAL, false, true, true); JFreeChart charti = ChartFactory.createLineChart("QUR", "year", "maths", dataset, PlotOrientation.VERTICAL, false, true, true); BarRenderer renderer = null; CategoryPlot plot = null; renderer = new BarRenderer(); ChartFrame frame = new ChartFrame("Chart", chart); frame.setVisible(true); frame.setSize(400, 450); ChartFrame frame1 = new ChartFrame("Chart", charti); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); frame.setLocation(dim.width / 10 - frame.getSize().width / 10, dim.height / 12 - frame.getSize().height / 12); frame1.setVisible(true); frame1.setSize(400, 450); frame1.setLocation(dim.width - frame1.getSize().width, dim.height - frame1.getSize().height); //.createAreaChart("QUERY CHART","maths"," eng", dataset,) } catch (SQLException ex) { Logger.getLogger(Reports.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:flight_ranker.my_Jframe.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed DefaultPieDataset piedataset = new DefaultPieDataset(); piedataset.setValue("One", new Integer(10)); piedataset.setValue("Two", new Integer(20)); piedataset.setValue("Three", new Integer(30)); piedataset.setValue("Four", new Integer(40)); 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);//w ww . j ava 2 s .c o m frame.setSize(450, 500); }
From source file:UserInterface.DoctorRole.ViewDonorReport.java
public void Graph() { dataset = new DefaultCategoryDataset(); if (vitalSigndir.getVitalSignDir().isEmpty()) { for (VitalSign vs : vitalSigndir.getVitalSignDir()) { dataset.addValue(Float.parseFloat(vs.getBloodPressure()), "Blood Pressure", vs.getTimestamp()); dataset.addValue(Float.parseFloat(vs.getBloodPlatlets()), "Blood Platelets", vs.getTimestamp()); dataset.addValue(Float.parseFloat(vs.getHemoglobinLevel()), "Hemoglobin Level", vs.getTimestamp()); //dataset.addValue(vs.getWeight(), "Weight", vs.getTimestamp()); }// www. j ava 2 s . c om JFreeChart chartFactory = ChartFactory.createBarChart3D("VitalSign", "Time", "VitalSign", dataset, PlotOrientation.VERTICAL, true, true, false); BarRenderer renderer = null; CategoryPlot plot = chartFactory.getCategoryPlot(); renderer = new BarRenderer(); ChartFrame frame = new ChartFrame("Bar Chart for VitalSign", chartFactory); frame.setVisible(true); frame.setSize(700, 320); } }
From source file:userinterface.HospitalAdminRole.DataAnalysisHospitalJPanel.java
private void seeChartBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seeChartBtnActionPerformed // TODO add your handling code here: int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0; for (Network network : business.getNetworkList()) { for (Enterprise enterprise : network.getEnterpriseDirectory().getEnterpriseList()) { if (enterprise instanceof HospitalEnterprise) { for (Organization org : enterprise.getOrganizationDirectory().getOrganizationList()) { for (WorkRequest request : org.getWorkQueue().getWorkRequestList()) { String bg = request.getBloodGroup(); if (bg.equalsIgnoreCase("a+")) { a++;//from www . j a v a 2 s .c om } if (bg.equalsIgnoreCase("a-")) { b++; } if (bg.equalsIgnoreCase("b+")) { c++; } if (bg.equalsIgnoreCase("b-")) { d++; } if (bg.equalsIgnoreCase("ab+")) { e++; } if (bg.equalsIgnoreCase("ab-")) { f++; } if (bg.equalsIgnoreCase("o+")) { g++; } if (bg.equalsIgnoreCase("o-")) { h++; } } } } } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(a, "Number", "A+"); dataset.setValue(b, "Number", "A-"); dataset.setValue(c, "Number", "B+"); dataset.setValue(d, "Number", "B-"); dataset.setValue(e, "Number", "AB+"); dataset.setValue(f, "Number", "AB-"); dataset.setValue(g, "Number", "O+"); dataset.setValue(h, "Number", "O-"); JFreeChart chart = ChartFactory.createBarChart("Hospital Demands", "Blood Types", "Number", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.black); ChartFrame frame = new ChartFrame("Hospital Demands", chart); frame.setVisible(true); frame.setSize(450, 500); } }