Example usage for org.jfree.chart ChartFrame setVisible

List of usage examples for org.jfree.chart ChartFrame setVisible

Introduction

In this page you can find the example usage for org.jfree.chart ChartFrame setVisible.

Prototype

public void setVisible(boolean b) 

Source Link

Document

Shows or hides this Window depending on the value of parameter b .

Usage

From source file:UserInterface.ViewPatientJPanel.java

private void btnViewBarsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewBarsActionPerformed

    String legend = null;// w  w  w. j  a va  2s  . c om
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    for (VitalSign vs : patient.vitalSignHistory.getVitalSignHistory()) {

        if (vs.getState().equalsIgnoreCase("ABNORMAL"))
            legend = vs.getTimestamp().concat(" (" + vs.getState() + ")");
        else
            legend = vs.getTimestamp();

        dataset.addValue(vs.getRespiratoryRate(), legend, "Respiratory Rate");
        dataset.addValue(vs.getHeartRate(), legend, "Heart Rate");
        dataset.addValue(vs.getSystolicBloodPressure(), legend, "Blood Pressure");
        dataset.addValue(vs.getWeight(), legend, "Weight");

    }

    JFreeChart chart = ChartFactory.createBarChart3D("Vital Signs", "Vital Signs", "Values", dataset,
            PlotOrientation.VERTICAL, true, true, true);
    CategoryPlot P = chart.getCategoryPlot();
    P.setRangeGridlinePaint(Color.BLACK);

    ChartFrame frame = new ChartFrame("Bar Charts", chart);
    frame.setVisible(true);
    frame.setSize(650, 550);

}

From source file:UserInterfaces.HAdministration.BloodReportJPanel.java

private void personneljButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_personneljButton2ActionPerformed
    // TODO add your handling code here:

    int timeofadmin = 0;
    int timeofnurse = 0;
    int timeofpathology = 0;
    int timeofphar = 0;
    int timeofphysician = 0;
    int timeofsurgeon = 0;

    for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) {
        if (workRequest.getLevel2().equals(ErrorUtil.BLOOD_OR_BLOOD_PRODUCT)) {
            for (ErrorPerson ep : workRequest.getEpd().getErrorpersonlist()) {
                if (ep instanceof AdminstrationErrorPerson) {
                    // if (ep.getEpt().getValue().equals(ErrorPerson.ErrorPersonType.ADMINSTRATION.getValue())) {
                    timeofadmin = timeofadmin + 1;
                }//w w  w .j  av a 2  s .c  om
                if (ep instanceof NurseErrorPerson) {
                    timeofnurse = timeofnurse + 1;
                }
                if (ep instanceof PathologistriceErrorPerson) {
                    timeofpathology = timeofpathology + 1;
                }
                if (ep instanceof PharmacistErrorPerson) {
                    timeofphar = timeofphar + 1;
                }
                if (ep instanceof PhysicianErrorPerson) {
                    timeofphysician = timeofphysician + 1;
                }
                if (ep instanceof SurgeonErrorPerson) {
                    timeofsurgeon = timeofsurgeon + 1;
                }

            }
        }
    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(timeofadmin, "Adminstration", "Adminstration");
    dataset.addValue(timeofnurse, "Nurse", "Nurse");
    dataset.addValue(timeofpathology, "Pathologist", "Pathologist");
    dataset.addValue(timeofphar, "Pharmacist", "Pharmacist");
    dataset.addValue(timeofphysician, "Physician", "Physician");
    dataset.addValue(timeofsurgeon, "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);
    frame.setSize(900, 700);

}

From source file:datavis.Gui.java

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

    //Initialize a copy of the current Line chart on display and then create a pop-up containing it

    //Get the chart based on the Combobox item
    String sItem = jComboBox2.getSelectedItem().toString();
    sItem = sItem.replaceAll("\\s+", "");
    sItem = Character.toLowerCase(sItem.charAt(0)) + (sItem.length() > 1 ? sItem.substring(1) : "");

    //Create the pop-up
    JFreeChart popOut_PieChart = dataset.getLineGraphChart(sItem);
    ChartFrame frame = new ChartFrame(dataset.getStationName() + "  (" + dataset.getStationID() + ")",
            popOut_PieChart);/* w  w w.  j  a v a 2  s.co m*/
    frame.setVisible(true);
    frame.setSize(450, 450);

}

From source file:datavis.Gui.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

    //Initialize a copy of the current Pie chart on display and then create a pop-up containing it

    //Get the chart based on the Combobox item
    String sItem = jComboBox1.getSelectedItem().toString();
    sItem = sItem.replaceAll("\\s+", "");
    sItem = Character.toLowerCase(sItem.charAt(0)) + (sItem.length() > 1 ? sItem.substring(1) : "");

    JFreeChart popOut_PieChart = dataset.getPieChartChart(sItem);

    //Create the pop-up
    ChartFrame frame = new ChartFrame(dataset.getStationName() + "  (" + dataset.getStationID() + ")",
            popOut_PieChart);/*ww  w  .  java2s.co m*/
    frame.setVisible(true);
    frame.setSize(450, 450);

}

From source file:datavis.Gui.java

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

    //Initialize a copy of the current Bar chart on display and then create a pop-up containing it

    //Get the chart based on the Combobox item

    String sItem = jComboBox3.getSelectedItem().toString();
    sItem = sItem.replaceAll("\\s+", "");
    sItem = Character.toLowerCase(sItem.charAt(0)) + (sItem.length() > 1 ? sItem.substring(1) : "");

    //Create the pop-up
    JFreeChart popOut_PieChart = dataset.getBarGraphChart(sItem);
    ChartFrame frame = new ChartFrame(dataset.getStationName() + "  (" + dataset.getStationID() + ")",
            popOut_PieChart);/*from w  w  w .j av a  2  s . c  om*/
    frame.setVisible(true);
    frame.setSize(450, 450);

}

From source file:UserInterfaces.HAdministration.MedicationJPanel.java

private void chartjButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chartjButton1ActionPerformed
    // TODO add your handling code here:

    int timeofadmin = 0;
    int timeofnurse = 0;
    int timeofpathology = 0;
    int timeofphar = 0;
    int timeofphysician = 0;
    int timeofsurgeon = 0;

    for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) {
        if (workRequest.getLevel2().equals(ErrorUtil.MEDICATION_OR_OTHER)) {
            for (ErrorPerson ep : workRequest.getEpd().getErrorpersonlist()) {
                if (ep instanceof AdminstrationErrorPerson) {
                    // if (ep.getEpt().getValue().equals(ErrorPerson.ErrorPersonType.ADMINSTRATION.getValue())) {
                    timeofadmin = timeofadmin + 1;
                }//from  www . j av  a 2 s .co m
                if (ep instanceof NurseErrorPerson) {
                    timeofnurse = timeofnurse + 1;
                }
                if (ep instanceof PathologistriceErrorPerson) {
                    timeofpathology = timeofpathology + 1;
                }
                if (ep instanceof PharmacistErrorPerson) {
                    timeofphar = timeofphar + 1;
                }
                if (ep instanceof PhysicianErrorPerson) {
                    timeofphysician = timeofphysician + 1;
                }
                if (ep instanceof SurgeonErrorPerson) {
                    timeofsurgeon = timeofsurgeon + 1;
                }

            }
        }
    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(timeofadmin, "Adminstration", "Adminstration");
    dataset.addValue(timeofnurse, "Nurse", "Nurse");
    dataset.addValue(timeofpathology, "Pathologist", "Pathologist");
    dataset.addValue(timeofphar, "Pharmacist", "Pharmacist");
    dataset.addValue(timeofphysician, "Physician", "Physician");
    dataset.addValue(timeofsurgeon, "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);
    frame.setSize(900, 700);

}

From source file:UserInterfaces.HAdministration.DeviceReportJPanel.java

private void personneljButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_personneljButton2ActionPerformed
    // TODO add your handling code here:

    int timeofadmin = 0;
    int timeofnurse = 0;
    int timeofpathology = 0;
    int timeofphar = 0;
    int timeofphysician = 0;
    int timeofsurgeon = 0;

    int i;//  w  ww .j a v  a 2 s. co m
    int max = 0;

    for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) {
        if (workRequest.getLevel2().equals(ErrorUtil.DEVICE_OR_MEDICAL)) {
            for (ErrorPerson ep : workRequest.getEpd().getErrorpersonlist()) {
                if (ep instanceof AdminstrationErrorPerson) {
                    // if (ep.getEpt().getValue().equals(ErrorPerson.ErrorPersonType.ADMINSTRATION.getValue())) {
                    timeofadmin = timeofadmin + 1;
                }
                if (ep instanceof NurseErrorPerson) {
                    timeofnurse = timeofnurse + 1;
                }
                if (ep instanceof PathologistriceErrorPerson) {
                    timeofpathology = timeofpathology + 1;
                }
                if (ep instanceof PharmacistErrorPerson) {
                    timeofphar = timeofphar + 1;
                }
                if (ep instanceof PhysicianErrorPerson) {
                    timeofphysician = timeofphysician + 1;
                }
                if (ep instanceof SurgeonErrorPerson) {
                    timeofsurgeon = timeofsurgeon + 1;
                }

            }
        }
    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(timeofadmin, "Adminstration", "Adminstration");
    dataset.addValue(timeofnurse, "Nurse", "Nurse");
    dataset.addValue(timeofpathology, "Pathologist", "Pathologist");
    dataset.addValue(timeofphar, "Pharmacist", "Pharmacist");
    dataset.addValue(timeofphysician, "Physician", "Physician");
    dataset.addValue(timeofsurgeon, "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);
    frame.setSize(900, 700);

}

From source file:UserInterfaces.HAdministration.SurgeryJPanel.java

private void chartjButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chartjButton1ActionPerformed
    // TODO add your handling code here:

    int timeofadmin = 0;
    int timeofnurse = 0;
    int timeofpathology = 0;
    int timeofphar = 0;
    int timeofphysician = 0;
    int timeofsurgeon = 0;

    for (WorkRequest workRequest : enterprise.getWorkQueue().getWorkRequestList()) {
        if (workRequest.getLevel2().equals(ErrorUtil.SURGERY_OR_ANESTHESIA)) {
            for (ErrorPerson ep : workRequest.getEpd().getErrorpersonlist()) {
                if (ep instanceof AdminstrationErrorPerson) {
                    // if (ep.getEpt().getValue().equals(ErrorPerson.ErrorPersonType.ADMINSTRATION.getValue())) {
                    timeofadmin = timeofadmin + 1;
                }// ww w.  j  a  v a 2 s .  c o  m
                if (ep instanceof NurseErrorPerson) {
                    timeofnurse = timeofnurse + 1;
                }
                if (ep instanceof PathologistriceErrorPerson) {
                    timeofpathology = timeofpathology + 1;
                }
                if (ep instanceof PharmacistErrorPerson) {
                    timeofphar = timeofphar + 1;
                }
                if (ep instanceof PhysicianErrorPerson) {
                    timeofphysician = timeofphysician + 1;
                }
                if (ep instanceof SurgeonErrorPerson) {
                    timeofsurgeon = timeofsurgeon + 1;
                }

            }
        }
    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(timeofadmin, "Adminstration", "Adminstration");
    dataset.addValue(timeofnurse, "Nurse", "Nurse");
    dataset.addValue(timeofpathology, "Pathologist", "Pathologist");
    dataset.addValue(timeofphar, "Pharmacist", "Pharmacist");
    dataset.addValue(timeofphysician, "Physician", "Physician");
    dataset.addValue(timeofsurgeon, "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);
    frame.setSize(900, 700);

}

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;//  ww  w  .  ja  va  2  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.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 ww  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);
}