List of usage examples for org.jfree.chart ChartFrame ChartFrame
public ChartFrame(String title, JFreeChart chart)
From source file:dumbara.view.Chart1.java
public static void getBottleIncome() { DefaultCategoryDataset objDataset = new DefaultCategoryDataset(); try {//from w w w. j a v a 2 s . c o m Chart3[] chart3s = SalesController.getBottleIncome(); for (Chart3 chart3 : chart3s) { objDataset.setValue(chart3.getIncome(), "Bottle Income", chart3.getBottleID()); } } catch (ClassNotFoundException | SQLException ex) { Logger.getLogger(Chart1.class.getName()).log(Level.SEVERE, null, ex); } // Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, -1); Date result = cal.getTime(); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E yyyy.MM.dd"); String format = simpleDateFormat.format(result); Date date = new Date(); String format1 = simpleDateFormat.format(date); JFreeChart objChart = ChartFactory.createBarChart( "Sales Comparisson by Bottle ID from " + format + " to " + format1, "Bottle 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:Logic.FinanceController.java
public void drawYearlyChart(String olddate, String newdate) { int[] valuesOld; int[] valuesnew; valuesOld = getFinacialRecords(olddate); valuesnew = getFinacialRecords(newdate); int oldcost = -(valuesOld[1] + valuesOld[2] + valuesOld[3]); int oldprofit = valuesOld[0] - oldcost; int newcost = -(valuesnew[1] + valuesnew[2] + valuesnew[3]); int newprofit = valuesnew[0] - newcost; DefaultCategoryDataset data = new DefaultCategoryDataset(); data.setValue(valuesOld[0], olddate, "Sales"); data.setValue(oldcost, olddate, "Cost"); data.setValue(oldprofit, olddate, "Profit"); data.setValue(valuesnew[0], newdate, "Sales"); data.setValue(newcost, newdate, "Cost"); data.setValue(newprofit, newdate, "Profit"); JFreeChart chart = ChartFactory.createBarChart3D("Profit Analysis", "Years", "Values in Rupees", data, PlotOrientation.VERTICAL, true, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.MAGENTA); ChartFrame frame = new ChartFrame("Testing", chart); frame.setVisible(true);/*from w w w . j a va 2s.c om*/ frame.setLocation(910, 100); frame.setSize(400, 400); }
From source file:result.analysis.Chart.java
void subjectWisePerformance(String batch, String sem, String[] colleges, String code) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (String college : colleges) { db = mongoClient.getDB(college); String collection_name = "cs_" + batch + "_" + sem + "_sem"; DBCollection collection = db.getCollection(collection_name); analyz = new Analyze(db); double number[] = analyz.GetSubjectPassPercent(collection, code); dataset.setValue(number[1] - number[0], college, "FAIL"); dataset.setValue(number[0], college, "PASS"); }/*from w w w .j a v a2 s . com*/ JFreeChart pieChart = ChartFactory.createMultiplePieChart("Classwise Distribution", dataset, TableOrder.BY_ROW, true, true, true); // MultiplePiePlot plot = (PiePlot3D) pieChart.getPlot(); MultiplePiePlot plot = (MultiplePiePlot) pieChart.getPlot(); // plot.setStartAngle(290); // plot.setDirection(Rotation.CLOCKWISE); // plot.setForegroundAlpha(0.5f); JFreeChart subchart = plot.getPieChart(); PiePlot p = (PiePlot) subchart.getPlot(); p.setExplodePercent("PASS", 0.10); p.setExplodePercent("FAIL", 0.30); PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%")); p.setLabelGenerator(gen); ChartFrame frame = new ChartFrame("Subject Performance of " + batch + " year " + sem + " Semester ", pieChart); frame.setVisible(true); frame.setSize(500, 500); save_jpeg(pieChart); }
From source file:UserInterface.PatientRole.PatientReportChartJPanel.java
private void feedjButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_feedjButton2ActionPerformed // TODO add your handling code here: ReportToReporter report = enterprise.getReport(); if (report.getStatus() != null) { DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("satisfy", report.getYes()); pieDataset.setValue("not satisfy", report.getNo()); JFreeChart chart = ChartFactory.createPieChart("Satifaction", pieDataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); // p.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame frame = new ChartFrame("Chart for Satifaction", chart); frame.setVisible(true);/*from w w w .j a v a 2 s .com*/ frame.setSize(350, 450); } else { JOptionPane.showMessageDialog(null, "Sorry, the final report has not been generated"); } }
From source file:org.jfree.chart.demo.JFreeChartDemo.java
/** * Handles menu selections by passing control to an appropriate method. * * @param event the event.//from w w w. ja v a 2s.co m */ public void actionPerformed(final ActionEvent event) { final String command = event.getActionCommand(); if (command.equals(EXIT_COMMAND)) { attemptExit(); } else if (command.equals(ABOUT_COMMAND)) { about(); } else { /// Loop through available commands to find index to current command. int chartnum = -1; int i = CHART_COMMANDS.length; while (i > 0) { --i; if (command.equals(CHART_COMMANDS[i][0])) { chartnum = i; i = 0; } } /// check our index is valid if ((chartnum >= 0) && (chartnum < this.frame.length)) { /// Check we have not already created chart. if (this.frame[chartnum] == null) { // setup the chart. DEMO.getChart(chartnum); // present it in a frame... String str = this.resources.getString(CHART_COMMANDS[chartnum][2] + ".title"); this.frame[chartnum] = new ChartFrame(str, DEMO.getChart(chartnum)); this.frame[chartnum].getChartPanel().setPreferredSize(new java.awt.Dimension(500, 270)); this.frame[chartnum].pack(); RefineryUtilities.positionFrameRandomly(this.frame[chartnum]); /// Set panel to zoomable if required try { str = this.resources.getString(CHART_COMMANDS[chartnum][2] + ".zoom"); if ((str != null) && (str.toLowerCase().equals("true"))) { final ChartPanel panel = this.frame[chartnum].getChartPanel(); panel.setMouseZoomable(true); panel.setHorizontalAxisTrace(true); panel.setVerticalAxisTrace(true); } } catch (Exception ex) { /// Filter out messages which for charts which do not have zoom /// specified. if (ex.getMessage().indexOf("MissingResourceException") == 0) { ex.printStackTrace(); } } this.frame[chartnum].setVisible(true); } else { this.frame[chartnum].setVisible(true); this.frame[chartnum].requestFocus(); } } } }
From source file:UserInterface.CentreForDiseaseControl.DataAnalysis.java
private void salesDetailJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salesDetailJButtonActionPerformed // TODO add your handling code here: int totalVaccinesSold = 0; int totalQuantity = 0; VaccineManufacturerEnterprise popularManufacturer = null; DefaultPieDataset pieDataset = new DefaultPieDataset(); for (VaccineManufacturerEnterprise manufactureres : enterprise.getVaccineManufacturerList()) { for (Order order : enterprise.getMasterOrderCatalog().getOrderList()) { for (OrderItem orderItem : order.getOrderItemList()) { if (orderItem.getVaccine().getVaccineManufacturer() == manufactureres) { totalQuantity = totalQuantity + orderItem.getTotalQuantity(); if (totalQuantity > totalVaccinesSold) { totalVaccinesSold = totalQuantity; popularManufacturer = manufactureres; }// ww w .ja v a2s . co m } } } pieDataset.setValue(manufactureres.getName(), totalQuantity); totalQuantity = 0; } JFreeChart chart = ChartFactory.createPieChart("Pie Chart", pieDataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); ChartFrame frame = new ChartFrame("Sale details of Manufacturers", chart); frame.setVisible(true); frame.setSize(450, 500); }
From source file:jsdp.app.inventory.univariate.CapacitatedStochasticLotSizing.java
static void plotOptimalPolicyCost(int targetPeriod, BackwardRecursionImpl recursion) { recursion.runBackwardRecursion(targetPeriod); XYSeries series = new XYSeries("Optimal policy"); for (double i = StateImpl.getMinState(); i <= StateImpl.getMaxState(); i += StateImpl.getStepSize()) { StateDescriptorImpl stateDescriptor = new StateDescriptorImpl(targetPeriod, i); series.add(i, recursion.getExpectedCost(stateDescriptor)); }/*from w w w .j a v a2 s. co m*/ XYDataset xyDataset = new XYSeriesCollection(series); JFreeChart chart = ChartFactory.createXYLineChart( "Optimal policy policy - period " + targetPeriod + " expected total cost", "Opening inventory level", "Expected total cost", xyDataset, PlotOrientation.VERTICAL, false, true, false); ChartFrame frame = new ChartFrame("Optimal policy", chart); frame.setVisible(true); frame.setSize(500, 400); }
From source file:UserInterface.DoctorRole.DoctorReportChartJPanel.java
private void personneljButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_personneljButton3ActionPerformed // TODO add your handling code here: ReportToReporter report = enterprise.getReport(); if (report.getStatus() != null) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(report.getTimeofadmin(), "Adminstration", "Adminstration"); dataset.addValue(report.getTimeofnurse(), "Nurse", "Nurse"); dataset.addValue(report.getTimeofpathology(), "Pathologist", "Pathologist"); dataset.addValue(report.getTimeofphar(), "Pharmacist", "Pharmacist"); dataset.addValue(report.getTimeofphysician(), "Physician", "Physician"); dataset.addValue(report.getTimeofsurgeon(), "Surgeon", "Surgeon"); //dataset.setValue(80, "masd", "sss"); JFreeChart chart = ChartFactory.createBarChart("Personnel", "Position", "Times", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinePaint(Color.WHITE); ChartFrame frame = new ChartFrame("Chart for ERROR", chart); frame.setVisible(true);// w w w. j av a2 s . co m frame.setSize(550, 550); } else { JOptionPane.showMessageDialog(null, "Sorry, the final report has not been generated"); } }
From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java
private void viewAlignmentBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewAlignmentBtnActionPerformed DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) { dataSet.setValue(carList.getAlignment(), "Alignment", carList.getTimestamp()); }/*from w w w .j a va2 s.co m*/ JFreeChart chart = ChartFactory.createBarChart("Alignment", "Timestamp", "Alignment", dataSet, PlotOrientation.HORIZONTAL.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLACK); ChartFrame frame = new ChartFrame("ALIGNMENT GRAPH", chart); frame.setVisible(true); frame.setSize(600, 600); // TODO add your handling code here: }
From source file:UserInterface.StoreManager.StoreReportsPanel.java
private void storeKeeperButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_storeKeeperButtonActionPerformed // TODO add your handling code here: ArrayList<Comparison> cmp1 = new ArrayList<>(); int x = 0;// www .jav a 2 s . co m for (Organization org : enterprise.getOrganizationDirectory().getOrganizationList()) { if (org instanceof StoreKeeperOrganization) { System.out.println("Hi"); for (UserAccount ua : org.getUserAccountDirectory().getUserAccountList()) { x = 0; for (WorkRequest w : ua.getWorkQueue().getWorkRequestList()) { x++; } Comparison c = new Comparison(ua.getEmployee().getName(), x); cmp1.add(c); } } } Collections.sort(cmp1); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); if (cmp1.size() >= 3) { dataset.setValue(cmp1.get(0).getNumber(), "WorkRequests", cmp1.get(0).getString()); dataset.setValue(cmp1.get(1).getNumber(), "WorkRequests", cmp1.get(1).getString()); dataset.setValue(cmp1.get(2).getNumber(), "WorkRequests", cmp1.get(2).getString()); } else { for (Comparison c : cmp1) { dataset.setValue(c.getNumber(), "WorkRequests", c.getString()); } } JFreeChart chart = ChartFactory.createBarChart("Top StoreKeepers", "Storekeepers", "No of Workrequests Solved", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.BLUE); ChartFrame frame = new ChartFrame("StoreKeeper Report", chart); frame.setVisible(true); frame.setSize(600, 400); }