List of usage examples for org.jfree.data.category DefaultCategoryDataset setValue
public void setValue(double value, Comparable rowKey, Comparable columnKey)
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()); }/*from w ww .ja v a 2 s. com*/ 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:drugsupplychain.neu.css.gui.common.pharmaco.ProductDistributionDetailJPanel.java
/** * show distribution/*from w w w .java 2 s .c o m*/ */ private void showDistribution() { // TODO add your handling code here: DefaultCategoryDataset barchartDataset = new DefaultCategoryDataset(); if (null != product && null != product.getProductTracker() && product.getProductTracker().size() > 0) { for (String id : product.getProductTracker().keySet()) { TrackOrganization trackOrganization = product.getProductTracker().get(id); if (trackOrganization.getOrganization() instanceof Distributor) { barchartDataset.setValue(trackOrganization.getQuantity(), "QUANTITY", trackOrganization.getOrganization().getLocation()); } } JFreeChart barChartData = ChartFactory.createBarChart("MEDICINE DISTRIBUTION", "LOCATION", "QUANTITY", barchartDataset, PlotOrientation.VERTICAL, false, true, true); CategoryPlot barchart = barChartData.getCategoryPlot(); barchart.setRangeGridlinePaint(Color.ORANGE); ChartPanel barPanel = new ChartPanel(barChartData); barPanelDisplay.removeAll(); barPanelDisplay.add(barPanel, BorderLayout.CENTER); barPanelDisplay.validate(); } }
From source file:net.sourceforge.atunes.kernel.modules.statistics.StatsDialogController.java
/** * Gets the data set./* www .j a v a 2 s. c o m*/ * * @param list * the list * * @return the data set */ private DefaultCategoryDataset getDataSet(final List<?> list) { DefaultCategoryDataset result = new DefaultCategoryDataset(); if (list != null) { for (int i = 0; i < list.size(); i++) { Object[] obj = (Object[]) list.get(i); result.setValue((Integer) obj[1], "", (String) obj[0]); } } return result; }
From source file:com.indicator_engine.controller.GraphController.java
private CategoryDataset createCategoryDataSet(GLAIndicator glaIndicator) { GLAEntityDao glaEntityBean = (GLAEntityDao) appContext.getBean("glaEntity"); Gson gson = new Gson(); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); if (glaIndicator.getGlaIndicatorProps().isComposite()) { CompositeQuery[] compositeQuery = gson.fromJson(glaIndicator.getHql(), CompositeQuery[].class); for (int i = 0; i < compositeQuery.length; i++) { dataset.setValue(glaEntityBean.findNumber(compositeQuery[i].getQuery()), compositeQuery[i].getParentIndName(), compositeQuery[i].getParentIndName()); }//from w w w. j a v a2 s .c o m } else { dataset.setValue(glaEntityBean.findNumber(glaIndicator.getHql()), glaIndicator.getIndicator_name(), glaIndicator.getIndicator_name()); // glaIndicatorBean.updateStatistics(glaIndicator.getId()); } return dataset; }
From source file:Software_Jframes.chart.java
public void barchart(JDesktopPane jdesktop) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); try {/*from w w w.j a va2 s. c o m*/ ResultSet rs = db.statement().executeQuery("select date,name,amount from other_exp"); while (rs.next()) { String date = rs.getString("date"); String name = rs.getString("name"); String amnt = rs.getString("Amount"); int amount = Integer.parseInt(amnt); dataset.setValue(amount, name, date); } } catch (Exception e) { } JFreeChart chart = ChartFactory.createBarChart("Other Expenses for Last week", "Date", "Expense", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setBackgroundPaint(Color.WHITE); p.setRangeGridlinePaint(Color.black); ChartPanel panel = new ChartPanel(chart); jdesktop.add(panel).setSize(550, 230); }
From source file:ui.Interface.java
private void butChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butChartActionPerformed try {/* w ww. j a va 2 s . c om*/ if (txtNumbersAll.getText().equals("")) { JOptionPane.showMessageDialog(this, "Please fill out the Empty fields!", "Sorting Algo Simulator v2.0", javax.swing.JOptionPane.ERROR_MESSAGE); return; } DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(InsertInstructionCount, "InsertionSort", "InsertionSort"); dataset.setValue(SelectInstructionCount, "SelectionSort", "SelectionSort"); JFreeChart chart = ChartFactory.createBarChart("Instruction Count", "Instruction Count", "Unique Counts", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.white); chart.getTitle().setPaint(Color.blue); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.red); ChartFrame frame1 = new ChartFrame("Insertion Sort Vs Selection Sort - Performance Analyze", chart); Dimension screenSize = new Dimension(Toolkit.getDefaultToolkit().getScreenSize()); Dimension windowSize = new Dimension(getPreferredSize()); int wdwLeft2 = screenSize.width / 2 - windowSize.width / 2 - 200; int wdwTop2 = screenSize.height / 2 - windowSize.height / 2; frame1.setLocation(wdwLeft2, wdwTop2); frame1.pack(); frame1.setSize(400, 350); frame1.setVisible(true); DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(InsertTimeDiff, "InsertionSort", "InsertionSort"); dataset2.setValue(SelectTimeDiff, "SelectionSort", "SelectionSort"); JFreeChart chart2 = ChartFactory.createBarChart("Time Complexity* (can be vary)", "Time Complexity", "Nano Seconds", dataset2, PlotOrientation.VERTICAL, false, true, false); chart2.setBackgroundPaint(Color.white); chart2.getTitle().setPaint(Color.blue); CategoryPlot p2 = chart2.getCategoryPlot(); p2.setRangeGridlinePaint(Color.red); ChartFrame frame2 = new ChartFrame("Insertion Sort Vs Selection Sort - Performance Analyze", chart2); int wdwLeft = 50 + screenSize.width / 2 - windowSize.width / 2 + 200; int wdwTop = screenSize.height / 2 - windowSize.height / 2; frame2.setLocation(wdwLeft, wdwTop); frame2.pack(); frame2.setVisible(true); frame2.setSize(400, 350); } catch (Exception e) { e.printStackTrace(); } }
From source file:researchbehaviour.MainOutput.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try {/*from w ww . ja v a 2s . c om*/ FileReader reader = new FileReader("xml.txt"); BufferedReader br = new BufferedReader(reader); String line; line = br.readLine(); String[] strArray = line.split(" "); String[] FName = strArray[0].split(">"); String applicantName = FName[1] + " " + strArray[1]; jLabel20.setText(applicantName); double agr = 0; double con = 0; double ext = 0; double emo = 0; double ope = 0; double edu = 0; try { // agr = be.agreeablenessPersentage(); // con = be.conscientiousPersentage(); // ext = be.extraversionPersentage(); // emo = be.emotional_stabilityPersentage(); // ope = be.opennessPersentage(); // edu = be.educationPersentage(); // agr = pv.agrvalue(); con = pv.convalue(); ext = pv.extvalue(); emo = pv.emovalue(); ope = pv.opevalue(); edu = pv.eduvalue(); } catch (IOException ex) { Logger.getLogger(MainOutput.class.getName()).log(Level.SEVERE, null, ex); } DefaultCategoryDataset barChartData = new DefaultCategoryDataset(); barChartData.setValue(agr, "Personality Factor", "A"); barChartData.setValue(con, "Personality Factor", "C"); barChartData.setValue(ext, "Personality Factor", "E"); barChartData.setValue(emo, "Personality Factor", "N"); barChartData.setValue(ope, "Personality Factor", "O"); barChartData.setValue(edu - 20, "Personality Factor", "Education"); // barChartData.setValue(81.12, "Personality Factor", "A"); // barChartData.setValue(70.01, "Personality Factor", "C"); // barChartData.setValue(34.34, "Personality Factor", "E"); // barChartData.setValue(44.67,"Personality Factor", "N"); // barChartData.setValue(55.87, "Personality Factor", "O"); // barChartData.setValue(77.34, "Personality Factor", "Education"); JFreeChart barChart = ChartFactory.createBarChart("Applicant Statues", "Personality Factor", "Persentage", barChartData, PlotOrientation.VERTICAL, false, true, false); CategoryPlot barchart = barChart.getCategoryPlot(); barchart.setRangeGridlinePaint(Color.BLUE); // Plot plot = bar.getPlot(); BarRenderer barRenderer = (BarRenderer) barchart.getRenderer(); barRenderer.setSeriesPaint(0, Color.white); ChartPanel barPanel = new ChartPanel(barChart); panelChart.removeAll(); panelChart.add(barPanel, BorderLayout.CENTER); panelChart.validate(); // panelChart.repaint(); ChangeValues cvv = new ChangeValues(); ArrayList<Double> updateVal2 = new ArrayList<Double>(); updateVal2 = cvv.changedCutOff(); if (agr > updateVal2.get(0)) { jTextArea1.append( " The person has good Agreeableness,altruistic, sympathetic to others and eager to help them, and in return believes that others will be " + "\n" + " equally helpful." + "\n"); } else jTextArea1.append( " Low agreeableness, egocentric, sceptical of other's intentions, and competitive rather than co-operative." + "\n"); if (ope > updateVal2.get(2)) { jTextArea1.append( " Have active imagination, aesthetic sensitivity, attentiveness to inner feelings, a preference for variety, intellectual curiosity " + "\n" + " and independence of judgement " + "\n"); } else jTextArea1.append(" Not having enough openness to experience value." + "\n"); if (emo > updateVal2.get(3)) { jTextArea1.append( " Calm,even-tempered, relaxed and able to face stressful situations without becoming upset." + "\n"); } else { jTextArea1.append( " Not having good emotional stability.not calm,hot tempered ,not able to face stressfull situations sucessfully." + "\n"); } if (ext > updateVal2.get(1)) { jTextArea1.append( " Have good extraversion.social,active , talkative,energetic and optimistic person. " + "\n"); } else { jTextArea1.append( " Not having good extraversion.reserved rather than unfriendly, independent rather than followers, even-paced " + "\n" + "rather than sluggish." + "\n"); } if (con > updateVal2.get(4)) { jTextArea1.append(" Conscientious person,purposeful, strong-willed and determined." + "\n"); } else { jTextArea1.append(" Not having enough Conscientious." + "\n"); } } catch (IOException ex) { Logger.getLogger(MainOutput.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:UserInterface.SupplierRole.ProductSalesReviewJPanel.java
private void showTopProductButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showTopProductButtonActionPerformed // TODO add your handling code here: DefaultCategoryDataset barchartDataset = new DefaultCategoryDataset(); if (null != supplier.getProductCatalog()) { int productSalesValue = 0; for (Product product : supplier.getProductCatalog().getProductList()) { productSalesValue = product.getPrice() * (product.getInitialQuantity() - product.getAvailable()); barchartDataset.setValue(productSalesValue, "SALES VALUE", product.getProdName()); }/*from ww w . ja va 2 s.c o m*/ JFreeChart barChartData = ChartFactory.createBarChart("PRODUCT SALES VALUE", "PRODUCT NAME", "SALE AMOUNT", barchartDataset, PlotOrientation.VERTICAL, true, true, true); CategoryPlot barchart = barChartData.getCategoryPlot(); barchart.setRangeGridlinePaint(Color.ORANGE); ChartPanel barPanel = new ChartPanel(barChartData); jPanel1.removeAll(); jPanel1.add(barPanel); } }
From source file:com.indicator_engine.controller.GraphController.java
private CategoryDataset createCategoryDataSet(EntitySpecification entitySpecification) { GLAEntityDao glaEntityBean = (GLAEntityDao) appContext.getBean("glaEntity"); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); /*if(entitySpecification.getQuestionsContainer().getGenQueries().size() !=0){ for(GenQuery genQuery : entitySpecification.getQuestionsContainer().getGenQueries()) { total += glaEntityBean.findNumber(genQuery.getQuery()); }//from w w w . ja v a 2 s . co m }*/ dataset.setValue(glaEntityBean.findNumber(entitySpecification.getHql()), entitySpecification.getIndicatorName(), entitySpecification.getIndicatorName()); /*if(entitySpecification.getQuestionsContainer().getGenQueries().size() !=0){ for(GenQuery genQuery : entitySpecification.getQuestionsContainer().getGenQueries()) { dataset.setValue((glaEntityBean.findNumber(genQuery.getQuery()) *100)/total, genQuery.getIndicatorName(), genQuery.getIndicatorName()); } }*/ return dataset; }
From source file:ds.monte.carlo.Application.java
private void createLengthGraph(HashMap<Integer, Integer> probability) { DefaultCategoryDataset pDataset = new DefaultCategoryDataset(); for (Integer key : probability.keySet()) { pDataset.setValue(probability.get(key), "", "" + key); }//from w w w. j a v a2 s . c o m JFreeChart growChart = ChartFactory.createLineChart("Simulated annealing", "", "", pDataset, PlotOrientation.VERTICAL, false, false, false); growChart.setBackgroundPaint(Color.WHITE); CategoryPlot catPlot = growChart.getCategoryPlot(); catPlot.setRangeGridlinePaint(new Color(92, 184, 92)); ValueAxis vAxis = catPlot.getRangeAxis(); CategoryAxis cAxis = catPlot.getDomainAxis(); cAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); cAxis.setTickLabelsVisible(false); Font font = new Font("SansSerif", Font.PLAIN, 12); Font fontTitle = new Font("SansSerif", Font.PLAIN, 14); vAxis.setTickLabelFont(font); growChart.getTitle().setFont(fontTitle); LineAndShapeRenderer renderer = (LineAndShapeRenderer) catPlot.getRenderer(); Color bootstrapGreen = new Color(92, 184, 92); renderer.setSeriesPaint(0, bootstrapGreen); ChartPanel chartPanel = new ChartPanel(growChart); jPanel9.removeAll(); jPanel9.add(chartPanel, BorderLayout.CENTER); jPanel9.validate(); }