Example usage for org.jfree.chart ChartFrame setSize

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

Introduction

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

Prototype

public void setSize(int width, int height) 

Source Link

Document

The width and height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .

Usage

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;
                    }//w ww  .ja  v a  2 s  .  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:UserInterface.DoctorRole.ViewPatientReport.java

private void PiechartBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PiechartBtnActionPerformed
    // TODO add your handling code here:
    DefaultPieDataset dataset = new DefaultPieDataset();
    if (!(patient.getTestDir().getTestdir().isEmpty())) {
        for (Test vs : patient.getTestDir().getTestdir()) {

            dataset.setValue("Blood Pressure", Float.parseFloat(vs.getBloodPressure()));
            dataset.setValue("Blood Platelets", Float.parseFloat(vs.getBloodPlatlets()));
            dataset.setValue("Hemoglobin Level", Float.parseFloat(vs.getHemoglobinLevel()));
            //dataset.addValue(vs.getWeight(), "Weight", vs.getTimestamp());

        }//from w w w  . ja v  a 2 s  . c o m
        JFreeChart chartFactory = ChartFactory.createPieChart("Pie Chart", dataset, true, true, true);
        PiePlot p = (PiePlot) chartFactory.getPlot();
        // p.setForegroundAlpha(TOP_ALIGNMENT);
        ChartFrame frame = new ChartFrame("Pie Chart for VitalSign", chartFactory);
        frame.setVisible(true);
        frame.setSize(700, 320);
    } else {
        JOptionPane.showMessageDialog(this, "No Vital Signs To Display On Graph!!!");
    }
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getOilCheck(), "Oil", carList.getTimestamp());
    }//from w  w  w .j av  a2  s  .  co  m
    JFreeChart chart = ChartFactory.createBarChart("Oil", "Timestamp", "Oil", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("OIL GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600); // TODO add your handling code here:
}

From source file:UserInterface.DoctorRole.ViewPatientReport.java

public void Graph() {
    dataset = new DefaultCategoryDataset();
    if (!(patient.getTestDir().getTestdir().isEmpty())) {

        for (Test vs : patient.getTestDir().getTestdir()) {

            dataset.addValue(Float.parseFloat(vs.getBloodPressure()), "Blood Pressure", vs.getTimestamp());
            dataset.addValue(Float.parseFloat(vs.getBloodPlatlets()), "Blood Platelets", vs.getTimestamp());
            dataset.addValue(Float.parseFloat(vs.getHemoglobinLevel()), "Hemoglobin Level", vs.getTimestamp());
            //dataset.addValue(vs.getWeight(), "Weight", vs.getTimestamp());

        }/*from  w  w w.j a  v  a  2 s .co  m*/

        JFreeChart chartFactory = ChartFactory.createBarChart3D("VitalSign", "Time", "VitalSign", dataset,
                PlotOrientation.VERTICAL, true, true, false);

        BarRenderer renderer = null;
        CategoryPlot plot = chartFactory.getCategoryPlot();
        renderer = new BarRenderer();
        ChartFrame frame = new ChartFrame("Bar Chart for VitalSign", chartFactory);
        frame.setVisible(true);
        frame.setSize(700, 320);
    } else {
        JOptionPane.showMessageDialog(this, "No Vital Signs To Display On Graph!!!");
    }
}

From source file:Interface.FoodCollectionSupervisor.TypeOfFoodCitizens.java

private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCalculateActionPerformed
    // TODO add your handling code here:
    Date toDate1 = jDateChooser1.getDate();
    Date toDate2 = jDateChooser2.getDate();
    if ((toDate1 == null) || (toDate2 == null)) {
        JOptionPane.showMessageDialog(null, "Invalid date..Kindly enter valid date.");
        return;//from   www  . j a  va 2  s  .  c o m
    }

    long fromDate = (jDateChooser1.getDate().getTime()) / (1000 * 60 * 60 * 24);
    long toDate = (jDateChooser2.getDate().getTime()) / (1000 * 60 * 60 * 24);
    int homeFoodType = 0;
    int cannedType = 0;
    int purchasedType = 0;

    for (WorkRequest request : organization.getWorkQueue().getWorkRequestList()) {

        long requestDate = (request.getRequestDate().getTime()) / (1000 * 60 * 60 * 24);
        Employee e = request.getSender().getEmployee();
        if (e instanceof CitizenEmployee) {
            if ((requestDate >= fromDate) && (requestDate <= toDate)) {

                if (!request.getStatus().equalsIgnoreCase("New Request")) {

                    if (((FoodCollectionWorkRequest) request).getFood().getFoodType()
                            .equalsIgnoreCase("Canned Food")) {
                        cannedType++;
                    } else if (((FoodCollectionWorkRequest) request).getFood().getFoodType()
                            .equalsIgnoreCase("Home made Food")) {
                        homeFoodType++;

                    } else if (((FoodCollectionWorkRequest) request).getFood().getFoodType()
                            .equalsIgnoreCase("Purchased Food")) {
                        purchasedType++;
                    }

                }
            }
            //                else{
            //                    
            //                    JOptionPane.showMessageDialog(null, "There are no records for this search criteria.");
            //                }
        }

    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(cannedType, "Number of food collected", "Canned Food");
    dataset.setValue(purchasedType, "Number of food collected", "Purchased Food");
    dataset.setValue(homeFoodType, "Number of food collected", "Home made Food");

    JFreeChart chart = ChartFactory.createBarChart("Citizens-Different types of food collected",
            "Types of food", "Number of food collected", dataset, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.BLUE);
    ChartFrame frame = new ChartFrame("Bar Chart for Types of food collected", chart);
    frame.setVisible(true);
    frame.setSize(450, 350);

}

From source file:Interface.FoodCollectionSupervisor.TypesOfFoodRestaurant.java

private void btnCalculateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCalculateActionPerformed
    // TODO add your handling code here:
    Date toDate1 = jDateChooser1.getDate();
    Date toDate2 = jDateChooser2.getDate();
    if ((toDate1 == null) || (toDate2 == null)) {
        JOptionPane.showMessageDialog(null, "Invalid date..Kindly enter valid date.");
        return;/*from  w  ww .j  av  a  2 s.  c  o  m*/
    }
    long fromDate = (jDateChooser1.getDate().getTime()) / (1000 * 60 * 60 * 24);
    long toDate = (jDateChooser2.getDate().getTime()) / (1000 * 60 * 60 * 24);
    int homeFoodType = 0;
    int cannedType = 0;
    int purchasedType = 0;

    for (WorkRequest request : organization.getWorkQueue().getWorkRequestList()) {

        long requestDate = (request.getRequestDate().getTime()) / (1000 * 60 * 60 * 24);
        Employee e = request.getSender().getEmployee();
        if (e instanceof RestaurantEmployee) {
            if ((requestDate >= fromDate) && (requestDate <= toDate)) {

                if (!request.getStatus().equalsIgnoreCase("New Request")) {

                    if (((FoodCollectionWorkRequest) request).getFood().getFoodType()
                            .equalsIgnoreCase("Canned Food")) {
                        cannedType++;
                    } else if (((FoodCollectionWorkRequest) request).getFood().getFoodType()
                            .equalsIgnoreCase("Home made Food")) {
                        homeFoodType++;

                    } else if (((FoodCollectionWorkRequest) request).getFood().getFoodType()
                            .equalsIgnoreCase("Purchased Food")) {
                        purchasedType++;
                    }

                }
            }
            //                else{
            //                    
            //                    JOptionPane.showMessageDialog(null, "There are no records for this search criteria.");
            //                }
        }

    }

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(cannedType, "Number of food collected", "Canned Food");
    dataset.setValue(purchasedType, "Number of food collected", "Purchased Food");
    dataset.setValue(homeFoodType, "Number of food collected", "Home made Food");

    JFreeChart chart = ChartFactory.createBarChart("Restaurants-Different types of food collected",
            "Types of food", "Number of food collected", dataset, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.CYAN);
    ChartFrame frame = new ChartFrame("Bar Chart for Types of food collected", chart);
    frame.setVisible(true);
    frame.setSize(450, 350);
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void batteryBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_batteryBtnActionPerformed
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getBattery(), "Battery", carList.getTimestamp());
    }/*from  w  w  w .j av a2 s  . c o m*/
    JFreeChart chart = ChartFactory.createBarChart("Battery", "Timestamp", "Battery", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("BATTERY GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);
    // TODO add your handling code here:
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

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

    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getBrakingSys(), "Brakes", carList.getTimestamp());
    }//from ww  w  .  java2  s  .co m
    JFreeChart chart = ChartFactory.createBarChart("Brakes", "Timestamp", "Brakes", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("BRAKES GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);
    // TODO add your handling code here:
}

From source file:userInterface.CustomerWorkArea.ViewChartJPanel.java

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (CarInspection carList : userAccount.getPerson().getCarInspectionHistory().getCarInspectionHistory()) {
        dataSet.setValue(carList.getPollutionLevel(), "Pollution", carList.getTimestamp());
    }/*ww w .  j  a v  a  2s  .co m*/
    JFreeChart chart = ChartFactory.createBarChart("Pollution", "Timestamp", "Pollution", dataSet,
            PlotOrientation.HORIZONTAL.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("POLLUTION GRAPH", chart);
    frame.setVisible(true);
    frame.setSize(600, 600); // TODO add your handling code here:
}

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   www  . ja va  2 s .c o  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:
}