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.StoreManager.StoreReportsPanel.java

private void productReportButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_productReportButtonActionPerformed
    // TODO add your handling code here:
    ArrayList<Comparison> cmp1 = new ArrayList<>();

    for (Product p : enterprise.getProductCatalog().getProductList()) {
        Comparison c = new Comparison(p.getName(), p.getSearchCount());
        cmp1.add(c);/*  ww w .  j a v a 2  s  .c om*/
    }

    Collections.sort(cmp1);

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    dataset.setValue(cmp1.get(0).getNumber(), "SearchCount", cmp1.get(0).getString());
    dataset.setValue(cmp1.get(1).getNumber(), "SearchCount", cmp1.get(1).getString());
    dataset.setValue(cmp1.get(2).getNumber(), "SearchCount", cmp1.get(2).getString());

    JFreeChart chart = ChartFactory.createBarChart("Top 3 Searched Products", "Products", "SearchCounts",
            dataset, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLUE);
    ChartFrame frame = new ChartFrame("Search Report", chart);
    frame.setVisible(true);
    frame.setSize(600, 400);
}

From source file:UserInterface.Supplier.SalesOverviewJPanel.java

private void viewGraphJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewGraphJButtonActionPerformed
    DefaultTableModel dtm = (DefaultTableModel) performanceJTable.getModel();
    int rows = dtm.getRowCount();

    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (int i = 0; i < rows; i++) {
        int quant = (int) performanceJTable.getValueAt(i, 1);
        dataSet.setValue(quant, "QuantitySold", (String) performanceJTable.getValueAt(i, 0));
    }/*  w  w w  . j a v a  2s . c  om*/

    JFreeChart chart = ChartFactory.createBarChart("Sales Performance Chart", "Product Name", "Quantity Sold",
            dataSet, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setRangeGridlinePaint(Color.BLACK);

    ChartFrame frame = new ChartFrame("Sales Overview", chart);
    frame.setVisible(true);
    frame.setSize(600, 600);

}

From source file:clientesbac.frmConsultaClientes.java

public void barras() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(1, "Cliente", "Regular");
    dataset.setValue(1, "Cliente", "Corporativo");
    dataset.setValue(1, "Cliente", "Adulto Mayor");
    dataset.setValue(1, "Cliente", "Embarazada");
    dataset.setValue(1, "Cliente", "Discapacitado");
    // Creando el Grafico
    JFreeChart chart = ChartFactory.createBarChart3D("Grfico de barras por tipo de Cliente", "", "Cantidad",
            dataset, PlotOrientation.VERTICAL, true, true, false);

    ChartFrame frame = new ChartFrame("Reporte", chart);
    frame.pack();/*from  ww w . ja va 2  s.  com*/
    frame.setVisible(true);
}

From source file:clientesbac.frmConsultaClientes.java

public void pastel() {
    // Fuente de Datos
    DefaultPieDataset data = new DefaultPieDataset();
    data.setValue("Regular", 40);
    data.setValue("Corporativo", 20);
    data.setValue("Adulto Mayor", 15);
    data.setValue("Embarazada", 15);
    data.setValue("Discapacitado", 10);

    // Creando el Grafico
    JFreeChart chart = ChartFactory.createPieChart("Grfico de pastel por tipo de Cliente", data, true, true,
            false);//from   w ww . ja  v a2  s  .  c  o m

    // Mostrar Grafico
    ChartFrame frame = new ChartFrame("Reporte", chart);
    frame.pack();
    frame.setVisible(true);
}

From source file:UserInterface.DoctorRole.DoctorReportChartJPanel.java

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

    ReportToReporter report = enterprise.getReport();
    if (report.getStatus() != null) {
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.addValue(report.getIncidentnumber(), "Incident", "Incident");
        dataset.addValue(report.getNearmissnumber(), "Near miss", "Near miss");
        dataset.addValue(report.getUnsafenumber(), "Unsafe condition", "Unsafe condition");

        JFreeChart chart = ChartFactory.createBarChart("Level1 Error", "Error Name", "Times", dataset,
                PlotOrientation.VERTICAL, false, true, false);
        CategoryPlot plot = chart.getCategoryPlot();
        plot.setRangeGridlinePaint(Color.DARK_GRAY);
        ChartFrame frame = new ChartFrame("Chart for ERROR", chart);
        frame.setVisible(true);
        frame.setSize(350, 450);/*from   w  ww.ja  v a 2s .c o  m*/
    } else {
        JOptionPane.showMessageDialog(null, "Sorry, the final report has not been generated");

    }

    // report.getMaxlevel1() = maxlevel1number;
}

From source file:UserInterface.DoctorRole.DoctorReportChartJPanel.java

private void feedjButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_feedjButton2ActionPerformed
    // TODO add your handling code here:
    ReportToReporter report = enterprise.getReport();
    if (report.getStatus() != null) {
        DefaultPieDataset pieDataset = new DefaultPieDataset();
        pieDataset.setValue("satisfy", report.getYes());
        pieDataset.setValue("not satisfy", report.getNo());
        JFreeChart chart = ChartFactory.createPieChart("Satifaction", pieDataset, true, true, true);

        PiePlot p = (PiePlot) chart.getPlot();
        // p.setForegroundAlpha(TOP_ALIGNMENT);

        ChartFrame frame = new ChartFrame("Chart for Satifaction", chart);
        frame.setVisible(true);
        frame.setSize(350, 450);//from w w  w  . j av a2s .co m
    } else {
        JOptionPane.showMessageDialog(null, "Sorry, the final report has not been generated");
    }

}

From source file:UserInterface.DoctorRole.DoctorReportChartJPanel.java

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

    ReportToReporter report = enterprise.getReport();
    if (report.getStatus() != null) {
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.addValue(report.getTimeofadmin(), "Adminstration", "Adminstration");
        dataset.addValue(report.getTimeofnurse(), "Nurse", "Nurse");
        dataset.addValue(report.getTimeofpathology(), "Pathologist", "Pathologist");
        dataset.addValue(report.getTimeofphar(), "Pharmacist", "Pharmacist");
        dataset.addValue(report.getTimeofphysician(), "Physician", "Physician");
        dataset.addValue(report.getTimeofsurgeon(), "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(550, 550);/*from   ww  w.  jav a  2  s.  co m*/

    } else {
        JOptionPane.showMessageDialog(null, "Sorry, the final report has not been generated");
    }
}

From source file:userinterface.AdministratorWorkArea.PopularDoctorJPanel.java

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

    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
    int i = 1;//from  www  . j  av  a 2  s.c  o m

    for (Employee doctor : docOrg.getEmployeeDirectory().getEmployeeList()) {

        dataSet.setValue(doctor.getPatientCount(), "Number of Patients Assigned to the Doctor",
                doctor.getName());

        i++;

    }

    JFreeChart chart = ChartFactory.createBarChart("Doctor Patient Graph", "Doctor Name", "Number Of Patients",
            dataSet, PlotOrientation.VERTICAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartFrame frame = new ChartFrame("Number of Patients Assigned to the Doctor", chart);
    frame.setVisible(true);
    frame.setSize(800, 550);

}

From source file:control.JGeraGraficos.java

public void PrintGraficoSegundoExemplo() {
    String valorJava = getValorArquivoTxt("c:\\AppsPrjFinal\\ESTOUROJVMJAVA.txt");
    String valorJavaThRead = getValorArquivoTxt("c:\\AppsPrjFinal\\ESTOUROJVMJAVATHREAD.txt");
    String valorJOCL = getValorArquivoTxt("c:\\AppsPrjFinal\\ESTOUROJVMJOCL.txt");
    if (valorJava.isEmpty()) {
        JOptionPane.showMessageDialog(new JPanel(), "Processo Java No Executado", "Executar Processo",
                JOptionPane.INFORMATION_MESSAGE);
    } else if (valorJavaThRead.isEmpty()) {
        JOptionPane.showMessageDialog(new JPanel(), "Processo Java ThRead No Executado", "Executar Processo",
                JOptionPane.INFORMATION_MESSAGE);
    } else if (valorJOCL.isEmpty()) {
        JOptionPane.showMessageDialog(new JPanel(), "Processo JOCL No Executado", "Executar Processo",
                JOptionPane.INFORMATION_MESSAGE);
    } else {/*from w  w w.java 2  s.  com*/
        DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        dataset.clear();
        dataset.addValue(Float.parseFloat(valorJava), "Java", "Java");
        dataset.addValue(Float.parseFloat(valorJavaThRead), "Java ThRead", "Java ThRead");
        dataset.addValue(Float.parseFloat(valorJOCL), "JOCL", "JOCL");
        JFreeChart chart = ChartFactory.createBarChart("Grafio de Performance", null, "Tempo(ms)", dataset,
                PlotOrientation.VERTICAL, true, true, true);
        ChartFrame frame = new ChartFrame("Grafio de Performance", chart);

        frame.setBounds(300, 78, 800, 620);
        frame.setVisible(true);
    }
}

From source file:UserInterface.PatientRole.PatientReportChartJPanel.java

private void feedjButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_feedjButton2ActionPerformed
    // TODO add your handling code here:
    ReportToReporter report = enterprise.getReport();
    if (report.getStatus() != null) {
        DefaultPieDataset pieDataset = new DefaultPieDataset();
        pieDataset.setValue("satisfy", report.getYes());
        pieDataset.setValue("not satisfy", report.getNo());
        JFreeChart chart = ChartFactory.createPieChart("Satifaction", pieDataset, true, true, true);

        PiePlot p = (PiePlot) chart.getPlot();
        // p.setForegroundAlpha(TOP_ALIGNMENT);

        ChartFrame frame = new ChartFrame("Chart for Satifaction", chart);
        frame.setVisible(true);
        frame.setSize(350, 450);//from  w ww . j  a  v  a  2s.com
    } else {
        JOptionPane.showMessageDialog(null, "Sorry, the final report has not been generated");
    }
}