List of usage examples for org.jfree.data.category DefaultCategoryDataset setValue
public void setValue(double value, Comparable rowKey, Comparable columnKey)
From source file:pidev.gui.FrameStat.java
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(80, "Marks", "Student1"); dataset.setValue(50, "Marks", "Student2"); dataset.setValue(75, "Marks", "Student3"); dataset.setValue(95, "Marks", "Student4"); JFreeChart chart = ChartFactory.createBarChart("Student score", "Student Name", "Marks", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot p = chart.getCategoryPlot(); p.setRangeGridlinePaint(Color.black); ChartFrame frame = new ChartFrame("Bar Chart for student", chart); frame.setVisible(true);//from w ww. j a v a2 s . c om frame.setSize(450, 350); }
From source file:id.aas.apps.mvc.view.frameChart.java
public void setChartBar() throws SQLException { double Lunas = 0; double Casbon = 0; String queryLunas = "SELECT SUM(total_tagihan) from transaksi where keterangan='Lunas'"; String queryCasbon = "SELECT SUM(total_tagihan) from transaksi where keterangan='Cash Bon'"; ConnectionDB.InstanceDB.openConnection(); ResultSet rs = ConnectionDB.InstanceDB.RunSelectQuery(queryLunas); while (rs.next()) { Lunas = rs.getDouble(1);/* ww w . j a va2 s . c o m*/ } System.out.println(Lunas); ResultSet rs1 = ConnectionDB.InstanceDB.RunSelectQuery(queryCasbon); while (rs1.next()) { Casbon = rs1.getDouble(1); } System.out.println(Casbon); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(Lunas, "Lunas", "Catatan Uang Pendapatan"); dataset.setValue(Casbon, "Cash Bon", "Catatan Uang Pendapatan"); JFreeChart chart = ChartFactory.createBarChart3D("Catatan Uang Pendapatan dan Piutang", "Keterangan Pembayaran", "Jumlah Uang", dataset); ChartPanel cPanel = new ChartPanel(chart); panel1.add(cPanel); }
From source file:classes.SharedClass.java
public void getStatistics() { result = db.select("member", new String[] { " count(id) id" }, new String[] { "id" }, new String[] { "99999" }, "!=", "and"); try {//from ww w. ja va 2s.co m if (result.next()) { memberId = result.getInt("id"); } } catch (SQLException ex) { Logger.getLogger(SharedClass.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); } //book result = db.select("book", new String[] { "count(id)" }, new String[] { "id" }, new String[] { "99999" }, "!=", "and"); try { if (result.next()) { bookId = result.getInt(1); } } catch (SQLException ex) { Logger.getLogger(SharedClass.class.getName()).log(Level.SEVERE, null, ex); } //operations result = db.select("operations", new String[] { "count(id)" }, new String[] { "type" }, new String[] { "borrowed" }, "=", "and"); try { if (result.next()) { operationsId = result.getInt(1); } } catch (SQLException ex) { Logger.getLogger(SharedClass.class.getName()).log(Level.SEVERE, null, ex); } DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); dataSet.setValue(memberId, "Percent", "Members"); dataSet.setValue(bookId, "Percent", "Books"); dataSet.setValue(operationsId, "Percent", "Borrowe books"); JFreeChart chart = ChartFactory.createBarChart3D("Statistics", "Fields", "Percent", dataSet, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.yellow); chart.getTitle().setPaint(Color.red); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinePaint(Color.blue); ChartFrame frame = new ChartFrame("Statistics", chart); frame.setLocationRelativeTo(null); frame.setSize(500, 550); frame.setVisible(true); }
From source file:de.h_da.fbi.rfid.gui.UHF_GUI.java
/** * Creates a sample dataset//from w ww. j a v a 2 s . co m */ private CategoryDataset createDataset() { DefaultCategoryDataset result = new DefaultCategoryDataset(); result.setValue(3, "bla", getTimeValue()); result.setValue(2, "blub", "hallo"); return result; }
From source file:Balo.Main.java
private void aaaAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_aaaAncestorAdded // TODO add your handling code here: DefaultCategoryDataset barChart = new DefaultCategoryDataset(); barChart.setValue(200, "Contribution Amount", "January"); barChart.setValue(550, "Contribution Amount", "February"); barChart.setValue(300, "Contribution Amount", "March"); JFreeChart jbarChart = ChartFactory.createBarChart("Bar chart", "Monthly", "Contribution Amount", barChart, PlotOrientation.HORIZONTAL, true, true, true); CategoryPlot barchrt = (CategoryPlot) jbarChart.getPlot(); barchrt.setRangeGridlinePaint(Color.BLUE); ChartPanel barPanel = new ChartPanel(jbarChart); aaa.removeAll();/*from w w w . jav a 2 s. co m*/ aaa.setLayout(new BorderLayout()); aaa.add(barPanel, BorderLayout.CENTER); aaa.validate(); }
From source file:wtw.ui.GetChartAction.java
@Override public String execute() throws Exception { Object start = ActionContext.getContext().getSession().get("start"); Object end = ActionContext.getContext().getSession().get("end"); if (start != null && end != null) { startdate = (String) start; enddate = (String) end;/*from www . ja v a2s .c om*/ } if (start == null || end == null) { all = 6; mobile = 1; web = 1; software = 1; design = 1; data = 1; other = 1; } else { Date date2; Date date; DateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); date = (Date) formater.parse(startdate); date2 = (Date) formater.parse(enddate); all = projectManager.getCountProjectInMonth(date, date2); mobile = projectManager.getCountProjectInMonthAndCategory(date, date2, " Mobile"); web = projectManager.getCountProjectInMonthAndCategory(date, date2, " Website"); software = projectManager.getCountProjectInMonthAndCategory(date, date2, " Software"); design = projectManager.getCountProjectInMonthAndCategory(date, date2, " Design"); data = projectManager.getCountProjectInMonthAndCategory(date, date2, " Data Entry"); other = projectManager.getCountProjectInMonthAndCategory(date, date2, " Other"); } DefaultCategoryDataset dataSet = new DefaultCategoryDataset(); dataSet.setValue(all, "Population", "Total"); dataSet.setValue(mobile, "Population", "Mobile"); dataSet.setValue(web, "Population", "Website"); dataSet.setValue(software, "Population", "Software"); dataSet.setValue(data, "Population", "Data Entry"); dataSet.setValue(design, "Population", "Design"); dataSet.setValue(other, "Population", "Other"); chart = ChartFactory.createBarChart3D("Report Quantity Project By Category", "Project Category", "Quantity of Project", dataSet, PlotOrientation.VERTICAL, false, true, false); return SUCCESS; }
From source file:view.tankDepthDetails.BarrChart.java
/** * Creates new form BarrChart/*from w w w . ja v a 2s .c om*/ */ public BarrChart() { initComponents(); DefaultCategoryDataset dcd = new DefaultCategoryDataset(); float s = 8; dcd.setValue(s, "Marks", "Dumindu"); dcd.setValue(88.80, "Marks", "lakal"); dcd.setValue(78.80, "Marks", "Charitha"); dcd.setValue(7.80, "Marks", "lahiru"); dcd.setValue(76.80, "Marks", "mahin"); dcd.setValue(90.80, "Marks", "gin"); JFreeChart Jchart = ChartFactory.createBarChart("Tank Level Records", "Time", "Tank Level", dcd, PlotOrientation.VERTICAL, true, true, false); CategoryPlot plot = Jchart.getCategoryPlot(); plot.setRangeGridlinePaint(java.awt.Color.black); ChartFrame chartfra = new ChartFrame("Tank Level Records", Jchart, true); // chartfra.setVisible(true); chartfra.setSize(400, 500); ChartPanel chartPanel = new ChartPanel(Jchart); jPanel2.removeAll(); jPanel2.add(chartPanel); jPanel2.updateUI(); }
From source file:Balo.Main.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO dadd your handling code here: DefaultCategoryDataset barChart = new DefaultCategoryDataset(); barChart.setValue(200, "Contribution Amount", "January"); barChart.setValue(550, "Contribution Amount", "February"); barChart.setValue(300, "Contribution Amount", "March"); JFreeChart jbarChart = ChartFactory.createBarChart("Bar chart", "Monthly", "Contribution Amount", barChart, PlotOrientation.HORIZONTAL, true, true, true); CategoryPlot barchrt = (CategoryPlot) jbarChart.getPlot(); barchrt.setRangeGridlinePaint(Color.BLUE); ChartPanel barPanel = new ChartPanel(jbarChart); barPanel.setPreferredSize(new Dimension(785, 440)); //size according to my window barPanel.setMouseWheelEnabled(true); JPanel jPanel = new JPanel(); jPanel.add(barPanel);//from w w w .j a v a 2s.c o m String filename = "F:barchart.jpg"; try { ChartUtilities.saveChartAsJPEG(new File(filename), jbarChart, 500, 300); } catch (IOException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:flight_ranker.my_Jframe.java
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(85, "Marks", "Science"); dataset.setValue(91, "Marks", "Maths"); dataset.setValue(97, "Marks", "Computer"); dataset.setValue(95, "Marks", "English"); JFreeChart chart = ChartFactory.createBarChart("Bar Chart", "Subject", "Marks", dataset, PlotOrientation.VERTICAL, false, true, false); CategoryPlot P = chart.getCategoryPlot(); P.setRangeGridlinePaint(Color.black); ChartFrame frame = new ChartFrame("Bar chart", chart); frame.setVisible(true);//from w w w .j a v a 2s .com frame.setSize(450, 351); }
From source file:edu.esprit.sweet4u.GUI.Statistique.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed ClientDAO cdao = new ClientDAO(); ResponsablePatisserieDAO rpdao = new ResponsablePatisserieDAO(); DefaultCategoryDataset barChartData = new DefaultCategoryDataset(); barChartData.setValue(cdao.calculNombreClient(), "Nombre des utilisateurs", "Clients"); barChartData.setValue(rpdao.calculNombreResponsable(), "Nombre des utilisateurs", "Responsables Ptisserie"); JFreeChart barChart = ChartFactory.createBarChart3D("Statistiques des membres", "Type", "Nombre des utilisateurs", barChartData, PlotOrientation.VERTICAL, rootPaneCheckingEnabled, rootPaneCheckingEnabled, rootPaneCheckingEnabled); CategoryPlot barchrt = barChart.getCategoryPlot(); barchrt.setRangeGridlinePaint(Color.ORANGE); ChartPanel barPanel = new ChartPanel(barChart); jPanel2.removeAll();//from w w w .j a va 2 s .c om jPanel2.add(barPanel, BorderLayout.CENTER); jPanel2.validate(); // DefaultPieDataset pieDataset = new DefaultPieDataset(); // pieDataset.setValue("Clients",cdao.calculNombreClient()); // // pieDataset.setValue("Responsables Ptisserie",rpdao.calculNombreResponsable()); // 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); // frame.setSize(600,700); }