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: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. ja  v  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: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  a2 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: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);/*from  ww  w .j ava  2  s . co  m*/
    frame.setVisible(true);
    frame.setSize(450, 450);

}

From source file:tema11.GUI.java

private void PlotButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PlotButton1MouseClicked

    //TxRes.setText(" ");

    String p1, p2 = new String();
    p1 = TxPol1.getText();// ww w.  ja va2  s .c  o  m
    //p2 = TxPol2.getText();
    int g1;
    int[] coef1;

    // g2 = Integer.parseInt(TxGrad2.getText());

    try {
        g1 = Integer.parseInt(TxGrad1.getText());
        coef1 = PolinomOperations.parseString(p1, g1);
        //coef2 = PolinomOperations.parseString(p1, g1);
        String chartTitle = "Object Movement Chart";
        String xAxisLabel = "X";
        String yAxisLabel = "Y";

        XYDataset dataset = createDataset(coef1);

        JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset);

        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();

        ChartFrame myFrame = new ChartFrame("Polinom chart", chart);
        myFrame.setLocation(200, 200);
        myFrame.setSize(400, 400);
        myFrame.setVisible(true);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, "Wrong polinom format", "Polinom Error", JOptionPane.ERROR_MESSAGE);
    }

}

From source file:tema11.GUI.java

private void PlotButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PlotButton2MouseClicked

    //TxRes.setText(" ");

    String p1, p2 = new String();
    p1 = TxPol2.getText();/*  w  w w  .j  a  v a 2 s  . co  m*/
    //p2 = TxPol2.getText();
    int g1;
    int[] coef1;

    // g2 = Integer.parseInt(TxGrad2.getText());

    try {
        g1 = Integer.parseInt(TxGrad2.getText());
        coef1 = PolinomOperations.parseString(p1, g1);
        //coef2 = PolinomOperations.parseString(p1, g1);
        String chartTitle = "Object Movement Chart";
        String xAxisLabel = "X";
        String yAxisLabel = "Y";

        XYDataset dataset = createDataset(coef1);

        JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset);

        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();

        ChartFrame myFrame = new ChartFrame("Polinom chart", chart);
        myFrame.setLocation(200, 200);
        myFrame.setSize(400, 400);
        myFrame.setVisible(true);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this, "Wrong polinom format", "Polinom Error", JOptionPane.ERROR_MESSAGE);
    }

}

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);//from w w w. j a va 2s  .c om
    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);/*  w  w w.  j  a  va  2s.  c o m*/
    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;
                }/* w  ww  .  j a  v a 2  s .  com*/
                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:tema11.GUI.java

private void PlotResultButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_PlotResultButtonMouseClicked

    // TxRes.setText(" ");

    String p1, p2 = new String();
    p1 = TxRes.getText();/*w ww  .  java 2  s  .c  om*/
    //p2 = TxPol2.getText();
    int g1, g2;
    int[] coef1;

    // g2 = Integer.parseInt(TxGrad2.getText());

    try {
        g1 = Integer.parseInt(TxGrad1.getText());
        g2 = Integer.parseInt(TxGrad2.getText());
        coef1 = PolinomOperations.parseString(p1, g1 + g2);
        //coef2 = PolinomOperations.parseString(p1, g1);
        String chartTitle = "Object Movement Chart";
        String xAxisLabel = "X";
        String yAxisLabel = "Y";

        XYDataset dataset = createDataset(coef1);

        JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, xAxisLabel, yAxisLabel, dataset);

        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();

        ChartFrame myFrame = new ChartFrame("Result Polinom chart", chart);
        myFrame.setLocation(200, 200);
        myFrame.setSize(400, 400);
        myFrame.setVisible(true);
    } catch (Exception e) {
        JOptionPane.showMessageDialog(this,
                "Wrong polinom format! Va rog sa editati rezultatul si in locul coeficientului liber adaugati astfel coef_liberx^0 (exemplu in loc de 5 scrieti 5x^0)",
                "Polinom Error", JOptionPane.ERROR_MESSAGE);
    }
}

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;/*from w w  w .  j  a  v a  2s  .c o 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);

}