List of usage examples for org.jfree.chart ChartFactory createPieChart
public static JFreeChart createPieChart(String title, PieDataset dataset, boolean legend, boolean tooltips, boolean urls)
From source file:UserInterfaces.HAdministration.BloodReportJPanel.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: int timeofem = 0; int timeofpha = 0; int timeofward = 0; int timeofor = 0; int timeoflab = 0; int timeofoutpatient = 0; int i;// w w w .j a va2 s . c o m int max = 0; for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) { if (workRequest.getLevel2().equals(ErrorUtil.BLOOD_OR_BLOOD_PRODUCT)) { if (workRequest.getLocation().equals(Location.EMERGENCY)) { timeofem = timeofem + 1; } if (workRequest.getLocation().equals(Location.LABORATORY)) { timeoflab = timeoflab + 1; } if (workRequest.getLocation().equals(Location.OR)) { timeofor = timeofor + 1; } if (workRequest.getLocation().equals(Location.OUTPATIEN)) { timeofoutpatient = timeofoutpatient + 1; } if (workRequest.getLocation().equals(Location.PHARMACY)) { timeofpha = timeofpha + 1; } if (workRequest.getLocation().equals(Location.WARD)) { timeofward = timeofward + 1; } } } int[] numbs; numbs = new int[6]; numbs[0] = timeofem; numbs[1] = timeoflab; numbs[2] = timeofor; numbs[3] = timeofoutpatient; numbs[4] = timeofpha; numbs[5] = timeofward; DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue(Location.EMERGENCY, timeofem); dataset.setValue(Location.LABORATORY, timeoflab); dataset.setValue(Location.OR, timeofor); dataset.setValue(Location.OUTPATIEN, timeofoutpatient); dataset.setValue(Location.PHARMACY, timeofpha); dataset.setValue(Location.WARD, timeofward); JFreeChart chart = ChartFactory.createPieChart(" Chart", dataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); ChartFrame chartFrame = new ChartFrame("Location of events", chart); chartFrame.setSize(450, 550); chartFrame.setVisible(true); }
From source file:UserInterfaces.HAdministration.DeviceReportJPanel.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: int timeofem = 0; int timeofpha = 0; int timeofward = 0; int timeofor = 0; int timeoflab = 0; int timeofoutpatient = 0; int i;//from w ww . j a v a 2 s. c o m int max = 0; for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) { if (workRequest.getLevel2().equals(ErrorUtil.DEVICE_OR_MEDICAL)) { if (workRequest.getLocation().equals(Location.EMERGENCY)) { timeofem = timeofem + 1; } if (workRequest.getLocation().equals(Location.LABORATORY)) { timeoflab = timeoflab + 1; } if (workRequest.getLocation().equals(Location.OR)) { timeofor = timeofor + 1; } if (workRequest.getLocation().equals(Location.OUTPATIEN)) { timeofoutpatient = timeofoutpatient + 1; } if (workRequest.getLocation().equals(Location.PHARMACY)) { timeofpha = timeofpha + 1; } if (workRequest.getLocation().equals(Location.WARD)) { timeofward = timeofward + 1; } } } int[] numbs; numbs = new int[6]; numbs[0] = timeofem; numbs[1] = timeoflab; numbs[2] = timeofor; numbs[3] = timeofoutpatient; numbs[4] = timeofpha; numbs[5] = timeofward; DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue(Location.EMERGENCY, timeofem); dataset.setValue(Location.LABORATORY, timeoflab); dataset.setValue(Location.OR, timeofor); dataset.setValue(Location.OUTPATIEN, timeofoutpatient); dataset.setValue(Location.PHARMACY, timeofpha); dataset.setValue(Location.WARD, timeofward); JFreeChart chart = ChartFactory.createPieChart(" Chart", dataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); ChartFrame chartFrame = new ChartFrame("Location of events", chart); chartFrame.setSize(450, 550); chartFrame.setVisible(true); }
From source file:UserInterfaces.HAdministration.MedicationJPanel.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: int timeofem = 0; int timeofpha = 0; int timeofward = 0; int timeofor = 0; int timeoflab = 0; int timeofoutpatient = 0; int i;//from w w w . j av a 2 s . c o m int max = 0; for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) { if (workRequest.getLevel2().equals(ErrorUtil.MEDICATION_OR_OTHER)) { if (workRequest.getLocation().equals(Location.EMERGENCY)) { timeofem = timeofem + 1; } if (workRequest.getLocation().equals(Location.LABORATORY)) { timeoflab = timeoflab + 1; } if (workRequest.getLocation().equals(Location.OR)) { timeofor = timeofor + 1; } if (workRequest.getLocation().equals(Location.OUTPATIEN)) { timeofoutpatient = timeofoutpatient + 1; } if (workRequest.getLocation().equals(Location.PHARMACY)) { timeofpha = timeofpha + 1; } if (workRequest.getLocation().equals(Location.WARD)) { timeofward = timeofward + 1; } } } int[] numbs; numbs = new int[6]; numbs[0] = timeofem; numbs[1] = timeoflab; numbs[2] = timeofor; numbs[3] = timeofoutpatient; numbs[4] = timeofpha; numbs[5] = timeofward; DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue(Location.EMERGENCY, timeofem); dataset.setValue(Location.LABORATORY, timeoflab); dataset.setValue(Location.OR, timeofor); dataset.setValue(Location.OUTPATIEN, timeofoutpatient); dataset.setValue(Location.PHARMACY, timeofpha); dataset.setValue(Location.WARD, timeofward); JFreeChart chart = ChartFactory.createPieChart(" Chart", dataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); ChartFrame chartFrame = new ChartFrame("Location of events", chart); chartFrame.setSize(450, 550); chartFrame.setVisible(true); }
From source file:org.jfree.eastwood.ChartEngine.java
/** * Creates a pie chart./* ww w .j a va 2 s.c o m*/ * * @return A pie chart. */ private static JFreeChart createPieChart() { JFreeChart chart = ChartFactory.createPieChart(null, null, false, true, false); chart.setBackgroundPaint(Color.white); PiePlot plot = (PiePlot) chart.getPlot(); plot.setBackgroundPaint(null); plot.setInsets(RectangleInsets.ZERO_INSETS); plot.setInteriorGap(0.06); plot.setStartAngle(0.0); plot.setLabelGenerator(null); plot.setBaseSectionOutlinePaint(Color.white); plot.setBaseSectionOutlineStroke(new BasicStroke(1.2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); plot.setOutlineVisible(false); plot.setLabelBackgroundPaint(null); plot.setLabelOutlinePaint(null); plot.setLabelShadowPaint(null); plot.setLabelPadding(RectangleInsets.ZERO_INSETS); plot.setLabelFont(new Font("Dialog", Font.PLAIN, 12)); plot.setLabelPaint(Color.darkGray); plot.setToolTipGenerator(new StandardPieToolTipGenerator("{2}")); return chart; }
From source file:UserInterfaces.HAdministration.SurgeryJPanel.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: int timeofem = 0; int timeofpha = 0; int timeofward = 0; int timeofor = 0; int timeoflab = 0; int timeofoutpatient = 0; int i;/*from w ww .ja v a 2 s . co m*/ int max = 0; for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) { if (workRequest.getLevel2().equals(ErrorUtil.SURGERY_OR_ANESTHESIA)) { if (workRequest.getLocation().equals(Location.EMERGENCY)) { timeofem = timeofem + 1; } if (workRequest.getLocation().equals(Location.LABORATORY)) { timeoflab = timeoflab + 1; } if (workRequest.getLocation().equals(Location.OR)) { timeofor = timeofor + 1; } if (workRequest.getLocation().equals(Location.OUTPATIEN)) { timeofoutpatient = timeofoutpatient + 1; } if (workRequest.getLocation().equals(Location.PHARMACY)) { timeofpha = timeofpha + 1; } if (workRequest.getLocation().equals(Location.WARD)) { timeofward = timeofward + 1; } } } int[] numbs; numbs = new int[6]; numbs[0] = timeofem; numbs[1] = timeoflab; numbs[2] = timeofor; numbs[3] = timeofoutpatient; numbs[4] = timeofpha; numbs[5] = timeofward; DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue(Location.EMERGENCY, timeofem); dataset.setValue(Location.LABORATORY, timeoflab); dataset.setValue(Location.OR, timeofor); dataset.setValue(Location.OUTPATIEN, timeofoutpatient); dataset.setValue(Location.PHARMACY, timeofpha); dataset.setValue(Location.WARD, timeofward); JFreeChart chart = ChartFactory.createPieChart(" Chart", dataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); ChartFrame chartFrame = new ChartFrame("Location of events", chart); chartFrame.setSize(450, 550); chartFrame.setVisible(true); }
From source file:ca.myewb.frame.servlet.GraphServlet.java
private JFreeChart getPostPie(Session s) { JFreeChart chart;// w w w.j a v a 2s . c o m DefaultPieDataset ds = new DefaultPieDataset(); int numPosts = 0; int numTypePosts = 0; String query; query = "select count(*) from PostModel as p where p.poster.gender='m' and p.emailed=true and p.date>?"; numTypePosts = ((Long) s.createQuery(query).setDate(0, GraphServlet.getStartDate()).list().get(0)) .intValue(); ; ds.setValue("Emails by Males", numTypePosts); numPosts += numTypePosts; query = "select count(*) from PostModel as p where p.poster.gender='m' and " + "p.parent is null and p.emailed=false and p.date>?"; numTypePosts = ((Long) s.createQuery(query).setDate(0, GraphServlet.getStartDate()).list().get(0)) .intValue(); ; ds.setValue("Posts by Males", numTypePosts); numPosts += numTypePosts; query = "select count(*) from PostModel as p where p.poster.gender='m' and " + "p.parent is not null and p.emailed=false and p.date>?"; numTypePosts = ((Long) s.createQuery(query).setDate(0, GraphServlet.getStartDate()).list().get(0)) .intValue(); ; ds.setValue("Replies by Males", numTypePosts); numPosts += numTypePosts; query = "select count(*) from PostModel as p where p.poster.gender!='f' and p.poster.gender!='m' and p.date>?"; numTypePosts = ((Long) s.createQuery(query).setDate(0, GraphServlet.getStartDate()).list().get(0)) .intValue(); ; ds.setValue("All Posts by Unknown Gender", numTypePosts); numPosts += numTypePosts; query = "select count(*) from PostModel as p where p.poster.gender='f' and " + "p.parent is not null and p.emailed=false and p.date>?"; numTypePosts = ((Long) s.createQuery(query).setDate(0, GraphServlet.getStartDate()).list().get(0)) .intValue(); ; ds.setValue("Replies by Females", numTypePosts); numPosts += numTypePosts; query = "select count(*) from PostModel as p where p.poster.gender='f' and " + "p.parent is null and p.emailed=false and p.date>?"; numTypePosts = ((Long) s.createQuery(query).setDate(0, GraphServlet.getStartDate()).list().get(0)) .intValue(); ; ds.setValue("Posts by Females", numTypePosts); numPosts += numTypePosts; query = "select count(*) from PostModel as p where p.poster.gender='f' and p.emailed=true and p.date>?"; numTypePosts = ((Long) s.createQuery(query).setDate(0, GraphServlet.getStartDate()).list().get(0)) .intValue(); ; ds.setValue("Emails by Females", numTypePosts); numPosts += numTypePosts; chart = ChartFactory.createPieChart("Post Type/Author Gender Breakdown (for " + numPosts + " posts)", ds, false, false, false); PiePlot plot = ((PiePlot) chart.getPlot()); StandardPieItemLabelGenerator n = new StandardPieItemLabelGenerator("{0} = {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0.0%")); plot.setLabelGenerator(n); return chart; }
From source file:msi.gama.outputs.layers.ChartLayerStatement.java
private void createChart(final IScope scope) { switch (type) { case SERIES_CHART: { chart = ChartFactory.createXYLineChart(getName(), "time", "", null, PlotOrientation.VERTICAL, true, false, false);//from w ww . j a v a 2s . co m break; } case PIE_CHART: { if (style.equals(IKeyword.THREE_D)) { chart = ChartFactory.createPieChart3D(getName(), null, false, true, false); } else if (style.equals(IKeyword.RING)) { chart = ChartFactory.createRingChart(getName(), null, false, true, false); } else if (style.equals(IKeyword.EXPLODED)) { chart = ChartFactory.createPieChart(getName(), null, false, true, false); exploded = true; } else { chart = ChartFactory.createPieChart(getName(), null, false, true, false); } break; } case HISTOGRAM_CHART: { if (style.equals(IKeyword.THREE_D)) { chart = ChartFactory.createBarChart3D(getName(), null, null, null, PlotOrientation.VERTICAL, true, true, false); } else if (style.equals(IKeyword.STACK)) { chart = ChartFactory.createStackedBarChart(getName(), null, null, null, PlotOrientation.VERTICAL, true, true, false); } else { chart = ChartFactory.createBarChart(getName(), null, null, null, PlotOrientation.VERTICAL, true, true, false); } break; } case XY_CHART: chart = ChartFactory.createXYLineChart(getName(), "", "", null, PlotOrientation.VERTICAL, true, false, false); break; case SCATTER_CHART: chart = ChartFactory.createXYLineChart(getName(), "", "", null, PlotOrientation.VERTICAL, true, false, false); break; case BOX_WHISKER_CHART: { chart = ChartFactory.createBoxAndWhiskerChart(getName(), "Time", "Value", (BoxAndWhiskerCategoryDataset) dataset, true); chart.setBackgroundPaint(new Color(249, 231, 236)); break; } } Plot plot = chart.getPlot(); chart.getTitle().setFont(getTitleFont()); if (backgroundColor == null) { plot.setBackgroundPaint(null); chart.setBackgroundPaint(null); chart.setBorderPaint(null); if (chart.getLegend() != null) { chart.getLegend().setBackgroundPaint(null); } } else { Color bg = backgroundColor; chart.setBackgroundPaint(bg); plot.setBackgroundPaint(bg); chart.setBorderPaint(bg); if (chart.getLegend() != null) { chart.getLegend().setBackgroundPaint(bg); } } // chart.getLegend().setItemPaint(axesColor); // chart.getLegend().setBackgroundPaint(null); if (plot instanceof CategoryPlot) { final CategoryPlot pp = (CategoryPlot) chart.getPlot(); pp.setDomainGridlinePaint(axesColor); pp.setRangeGridlinePaint(axesColor); // plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); // plot.setDomainCrosshairVisible(true); pp.setRangeCrosshairVisible(true); } else if (plot instanceof XYPlot) { final XYPlot pp = (XYPlot) chart.getPlot(); pp.setDomainGridlinePaint(axesColor); pp.setRangeGridlinePaint(axesColor); pp.setDomainCrosshairPaint(axesColor); pp.setRangeCrosshairPaint(axesColor); pp.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); pp.setDomainCrosshairVisible(true); pp.setRangeCrosshairVisible(true); } }
From source file:UserInterfaces.HAdministration.FallReportJPanel.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: int timeofem = 0; int timeofpha = 0; int timeofward = 0; int timeofor = 0; int timeoflab = 0; int timeofoutpatient = 0; int i;/*w ww . jav a 2 s . c o m*/ int max = 0; for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) { if (workRequest.getLevel2().equals(ErrorUtil.FALL)) { if (workRequest.getLocation().equals(Location.EMERGENCY)) { timeofem = timeofem + 1; } if (workRequest.getLocation().equals(Location.LABORATORY)) { timeoflab = timeoflab + 1; } if (workRequest.getLocation().equals(Location.OR)) { timeofor = timeofor + 1; } if (workRequest.getLocation().equals(Location.OUTPATIEN)) { timeofoutpatient = timeofoutpatient + 1; } if (workRequest.getLocation().equals(Location.PHARMACY)) { timeofpha = timeofpha + 1; } if (workRequest.getLocation().equals(Location.WARD)) { timeofward = timeofward + 1; } } } int[] numbs; numbs = new int[6]; numbs[0] = timeofem; numbs[1] = timeoflab; numbs[2] = timeofor; numbs[3] = timeofoutpatient; numbs[4] = timeofpha; numbs[5] = timeofward; DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue(Location.EMERGENCY, timeofem); dataset.setValue(Location.LABORATORY, timeoflab); dataset.setValue(Location.OR, timeofor); dataset.setValue(Location.OUTPATIEN, timeofoutpatient); dataset.setValue(Location.PHARMACY, timeofpha); dataset.setValue(Location.WARD, timeofward); JFreeChart chart = ChartFactory.createPieChart(" Chart", dataset, true, true, true); PiePlot p = (PiePlot) chart.getPlot(); ChartFrame chartFrame = new ChartFrame("Location of events", chart); chartFrame.setSize(450, 550); chartFrame.setVisible(true); }
From source file:userinterface.PatientRole.PatientWorkAreaJPanel.java
private void btnViewPieChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewPieChartActionPerformed if (patient.vitalSignHistory.getVitalSignHistory().size() > 0) { int selectedRow = tblVS.getSelectedRow(); if (selectedRow >= 0) { VitalSign vs = (VitalSign) tblVS.getValueAt(selectedRow, 0); DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("Respiratory Rate", new Float(vs.getRespiratoryRate())); pieDataset.setValue("Heart Rate", new Float(vs.getHeartRate())); pieDataset.setValue("Blood Pressure", new Float(vs.getSystolicBloodPressure())); pieDataset.setValue("Weight", new Float(vs.getWeight())); JFreeChart chart = ChartFactory.createPieChart("Pie chart", pieDataset, true, true, true); PiePlot P = (PiePlot) chart.getPlot(); ChartFrame frame = new ChartFrame("Pie Charrt", chart); frame.setVisible(true);/*from ww w. ja v a 2 s. c o m*/ frame.setSize(450, 500); } else { JOptionPane.showMessageDialog(null, "Please select a Vital Sign row to see the Pie Chart!"); } } else { JOptionPane.showMessageDialog(null, "There's no Vital Sign reported for this patient"); return; } }
From source file:org.talend.dataprofiler.chart.util.TopChartFactory.java
/** * //www. j a v a 2s . c om * DOC qiongli Comment method "createPieChart". * * @param title * @param dataset * @param showLegend * @param toolTips,if show the toolTips. * @param urls * @return */ public static JFreeChart createPieChart(String title, PieDataset dataset, boolean showLegend, boolean toolTips, boolean urls) { // ADD msjian TDQ-5112 2012-4-10: after upgrate to jfreechart-1.0.12.jar, change the default chart wallPaint ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); // TDQ-5112~ return ChartFactory.createPieChart(title, dataset, showLegend, toolTips, urls); }