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.AdminWorkArea.InventoryUsageJPanel.java

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

    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

    for (int i = 0; i < rows; i++) {
        int num = (int) deviceUsageJTable.getValueAt(i, 1);
        dataSet.setValue(num, "Number Of Reservations", String.valueOf(deviceUsageJTable.getValueAt(i, 0)));
    }//from   ww  w .j  av  a2  s  . c o m

    JFreeChart chart = ChartFactory.createBarChart("Device Usage Chart", "Device Name",
            "Number of Reservations", 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:library.ChartGUI.java

private void btArea2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btArea2ActionPerformed
    try {//w w  w .  j a  v  a  2 s  .  c  o  m
        // TODO add your handling code here:
        JDBCCategoryDataset dataset = new JDBCCategoryDataset(da.getConnection(), sql1);
        JFreeChart chart = ChartFactory.createAreaChart("Sum New Readers", "Month", "Count", dataset,
                PlotOrientation.VERTICAL, false, true, true);
        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();
        ChartFrame frame = new ChartFrame("Sum New Readers Chart", chart);
        frame.setVisible(true);
        frame.setSize(1250, 700);
        frame.setResizable(false);
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex);
    }
}

From source file:library.ChartGUI.java

private void btBar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btBar2ActionPerformed
    try {//from w w  w .j  a v a 2  s.  co  m
        // TODO add your handling code here:
        JDBCCategoryDataset dataset = new JDBCCategoryDataset(da.getConnection(), sql1);
        JFreeChart chart = ChartFactory.createBarChart3D("Sum New Readers", "Month", "Count", dataset,
                PlotOrientation.VERTICAL, false, true, true);
        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();
        ChartFrame frame = new ChartFrame("Sum New Readers Chart", chart);
        frame.setVisible(true);
        frame.setSize(1250, 700);
        frame.setResizable(false);
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex);
    }
}

From source file:com.vectorprint.report.jfree.ChartBuilder.java

public ChartFrame show() {
    ChartFrame cf = new ChartFrame(chart.getTitle().getText(), chart);

    cf.pack();/*from   ww  w  . j ava2  s.  com*/
    cf.setVisible(true);

    return cf;
}

From source file:library.ChartGUI.java

private void btLine2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLine2ActionPerformed
    // TODO add your handling code here:
    try {//from   ww w . j  a v a  2s .c  om
        // TODO add your handling code here:
        JDBCCategoryDataset dataset = new JDBCCategoryDataset(da.getConnection(), sql1);
        JFreeChart chart = ChartFactory.createLineChart3D("Sum New Readers", "Month", "Count", dataset,
                PlotOrientation.VERTICAL, false, true, true);
        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();
        ChartFrame frame = new ChartFrame("Sum New Readers Chart", chart);
        frame.setVisible(true);
        frame.setSize(1250, 700);
        frame.setResizable(false);
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex);
    }
}

From source file:UserInterface.CentreForDiseaseControl.DataAnalysis.java

private void summarizeInsuranceJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_summarizeInsuranceJButtonActionPerformed
    // TODO add your handling code here:
    DefaultPieDataset pieDataset = new DefaultPieDataset();
    int numberOfCitizensWithNoInsurance = 0;

    for (PHDEnterprise phdEnterprise : enterprise.getPhdList()) {
        for (SiteEnterprise siteEnterprise : phdEnterprise.getSiteList()) {
            for (Person person : siteEnterprise.getPersonDirectory().getPersonList()) {
                if (person instanceof Patient) {
                    Patient patient = (Patient) person;
                    if (patient.getInsuranceInformation().equals("No Insurance")) {
                        numberOfCitizensWithNoInsurance++;
                    }/*from ww  w  .  j  a v a 2s.  co m*/
                }
            }
        }
    }
    pieDataset.setValue("No Insurance", numberOfCitizensWithNoInsurance);

    int numberOfCitizensWithPrivateInsurance = 0;

    for (PHDEnterprise phdEnterprise : enterprise.getPhdList()) {
        for (SiteEnterprise siteEnterprise : phdEnterprise.getSiteList()) {
            for (Person person : siteEnterprise.getPersonDirectory().getPersonList()) {
                if (person instanceof Patient) {
                    Patient patient = (Patient) person;
                    if (patient.getInsuranceInformation().equals("Private Insurance Coverage")) {
                        numberOfCitizensWithPrivateInsurance++;
                    }
                }
            }
        }
    }
    pieDataset.setValue("Private Insurance", numberOfCitizensWithPrivateInsurance);

    int numberOfCitizensUnderInsured = 0;

    for (PHDEnterprise phdEnterprise : enterprise.getPhdList()) {
        for (SiteEnterprise siteEnterprise : phdEnterprise.getSiteList()) {
            for (Person person : siteEnterprise.getPersonDirectory().getPersonList()) {
                if (person instanceof Patient) {
                    Patient patient = (Patient) person;
                    if (patient.getInsuranceInformation().equals("Under Insured")) {
                        numberOfCitizensUnderInsured++;
                    }
                }
            }
        }
    }
    pieDataset.setValue("Under Insured", numberOfCitizensUnderInsured);

    JFreeChart chart = ChartFactory.createPieChart("Pie Chart", pieDataset, true, true, true);
    PiePlot p = (PiePlot) chart.getPlot();
    ChartFrame frame = new ChartFrame("Insurance Information of Citizens", chart);
    frame.setVisible(true);
    frame.setSize(450, 500);
}

From source file:library.ChartGUI.java

private void btLine1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLine1ActionPerformed
    try {//from  ww w.  j a  v  a2  s  . c o  m
        // TODO add your handling code here:
        JDBCCategoryDataset dataset = new JDBCCategoryDataset(da.getConnection(), sql0);
        JFreeChart chart = ChartFactory.createLineChart3D("Sum Brought Books", "Month", "Count", dataset,
                PlotOrientation.VERTICAL, false, true, true);
        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();
        ChartFrame frame = new ChartFrame("Sum Brought Books Chart", chart);
        frame.setVisible(true);
        frame.setSize(1250, 700);
        frame.setResizable(false);
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex);
    }
}

From source file:library.ChartGUI.java

private void btArea1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btArea1ActionPerformed
    try {/*www  .ja v a 2 s . c  om*/
        // TODO add your handling code here:
        JDBCCategoryDataset dataset = new JDBCCategoryDataset(da.getConnection(), sql0);
        JFreeChart chart = ChartFactory.createAreaChart("Sum Brought Books", "Month", "Count", dataset,
                PlotOrientation.VERTICAL, false, true, true);
        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();
        ChartFrame frame = new ChartFrame("Sum Brought Books Chart", chart);
        frame.setVisible(true);
        frame.setSize(1250, 700);
        frame.setResizable(false);
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex);
    }
}

From source file:library.ChartGUI.java

private void btBar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btBar1ActionPerformed
    try {//from w  ww .jav  a  2 s.c  o  m
        // TODO add your handling code here:
        JDBCCategoryDataset dataset = new JDBCCategoryDataset(da.getConnection(), sql0);
        JFreeChart chart = ChartFactory.createBarChart3D("Sum Brought Books", "Month", "Count", dataset,
                PlotOrientation.VERTICAL, false, true, true);
        BarRenderer renderer = null;
        CategoryPlot plot = null;
        renderer = new BarRenderer();
        ChartFrame frame = new ChartFrame("Sum Brought Books Chart", chart);
        frame.setVisible(true);
        frame.setSize(1250, 700);
        frame.setResizable(false);
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex);
    }
}

From source file:com.dnsoft.inmobiliaria.controllers.ConsultaCCPropietariosController.java

void muestraGrafico() {

    DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
    //DefaultPieDataset dataDolares = new DefaultPieDataset();

    for (Propietario propietario : listPropietarios) {
        CCPropietario ccPesos = cCPropietarioDAO.findUltimoMovimiento(Moneda.PESOS, propietario);
        if (ccPesos != null) {
            dataSet.setValue(ccPesos.getSaldo(), "Pesos", propietario.toString());
        }/*  ww w . j a v  a2  s .  com*/
        CCPropietario ccDolares = cCPropietarioDAO.findUltimoMovimiento(Moneda.DOLARES, propietario);
        if (ccDolares != null) {
            dataSet.setValue(ccDolares.getSaldo(), "Dolares", propietario.toString());
        }
    }
    // Creando el Grafico
    //JFreeChart chart = ChartFactory.createPieChart("Saldos", (PieDataset) dataSet, true, true, false);
    JFreeChart chart = ChartFactory.createMultiplePieChart("Saldos", dataSet, TableOrder.BY_ROW, false, true,
            false);
    //PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})", new DecimalFormat("0"), new DecimalFormat("0%"));
    MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot();
    JFreeChart subchart = plot.getPieChart();
    PiePlot p = (PiePlot) subchart.getPlot();
    p.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}: {1} ({2})"));
    //JFreeChart chartDolares = ChartFactory.createPieChart("Saldos en Dolares", dataDolares, true, true, false);
    // Mostrar Grafico
    ChartFrame frame = new ChartFrame("JFreeChart", chart);
    frame.pack();
    frame.setVisible(true);

}