Example usage for org.jfree.chart.plot PiePlot3D setForegroundAlpha

List of usage examples for org.jfree.chart.plot PiePlot3D setForegroundAlpha

Introduction

In this page you can find the example usage for org.jfree.chart.plot PiePlot3D setForegroundAlpha.

Prototype

public void setForegroundAlpha(float alpha) 

Source Link

Document

Sets the alpha-transparency for the plot and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:cz.zcu.kiv.eegdatabase.logic.controller.history.GraphController.java

protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    log.debug("Processing creating pie graph");
    String graphType = "";

    List<DownloadStatistic> topDownloadedFilesList = null;
    boolean isGroupAdmin;
    long countFile = 0;

    graphType = request.getParameter("graphType");
    int groupId = Integer.parseInt(request.getParameter("groupId"));
    isGroupAdmin = auth.userIsGroupAdmin();
    response.setContentType("image/png");

    topDownloadedFilesList = historyDao.getTopDownloadHistory(ChoiceHistory.valueOf(graphType), isGroupAdmin,
            groupId);//from  www.  j av  a2 s . co  m

    DefaultPieDataset dataset = new DefaultPieDataset();
    if (groupId != -1) {
        for (int i = 0; i < topDownloadedFilesList.size(); i++) {
            dataset.setValue(topDownloadedFilesList.get(i).getFileName(),
                    new Long(topDownloadedFilesList.get(i).getCount()));
            countFile = countFile + topDownloadedFilesList.get(i).getCount();
        }

        if (historyDao.getCountOfFilesHistory(ChoiceHistory.valueOf(graphType), isGroupAdmin,
                groupId) > countFile) {
            dataset.setValue("Other",
                    historyDao.getCountOfFilesHistory(ChoiceHistory.valueOf(graphType), isGroupAdmin, groupId)
                            - countFile);
        }
    }
    JFreeChart chart = ChartFactory.createPieChart3D("Daily downloads", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, 600, 400);
    response.getOutputStream().close();
    return null;
}

From source file:edu.smc.mediacommons.panels.PasswordPanel.java

private JFreeChart createChart(final PieDataset dataset) {
    final JFreeChart chart = ChartFactory.createPieChart3D("Password Pie Chart", // chart title
            dataset, // data
            true, // include legend
            true, false);/*from  w w  w. j a v a  2  s. c  o  m*/

    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");
    plot.setLabelGenerator(new CustomLabelGenerator());
    return chart;
}

From source file:org.openmicroscopy.shoola.util.ui.graphutils.PieChart.java

/** 
 * Creates the chart./*from  w  w  w  . j  a v  a  2 s .  c  om*/
 * @see ChartObject#createChar()
 */
void createChart() {
    chart = ChartFactory.createPieChart3D(title, dataset, false, true, false);
    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    if (backgroundImage != null) {
        plot.setBackgroundImage(backgroundImage);
    }
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.55f);
}

From source file:com.csc.GUI.ProfileGUIPanel.java

private JFreeChart createChart(PieDataset dataset, String title) {

    JFreeChart chart = ChartFactory.createPieChart3D(title, // chart title
            dataset, // data
            true, // include legend
            true, false);/*from  w ww .ja v  a 2  s  .c  o  m*/

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    return chart;

}

From source file:view.ViewReportUI.java

private JFreeChart createChart(PieDataset dataset, String hello) {
    //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.

    JFreeChart chart = ChartFactory.createPieChart3D("Expense Tracker", // chart title
            dataset, // data
            true, // include legend
            true, false);//from w ww .  j a va2s.c  o m

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    return chart;
}

From source file:systeminformation.Chart.java

public JFreeChart create3DPieChart(PieDataset dataset) {
    JFreeChart chart = ChartFactory.createPieChart3D("", dataset, true, true, true);
    PiePlot3D p = (PiePlot3D) chart.getPlot();

    PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})",
            new DecimalFormat("0"), new DecimalFormat("0%"));
    p.setLabelGenerator(gen);/*  w w  w  . j  a va  2  s.com*/
    //        p.setSimpleLabels(true);
    p.setForegroundAlpha(0.5f);
    p.setBackgroundAlpha(0.2f);
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);
    chart.setBorderVisible(true);

    return chart;
}

From source file:loansystem.visual.panel.StartPage.java

private void graficoPorEstado() {
    ArrayList<GraficoEntidad> graficos;
    graficos = gDao.obtenerPrestamosPorEstado();
    DefaultPieDataset data = new DefaultPieDataset();

    if (graficos.size() > 0) {

        for (GraficoEntidad result : graficos) {
            //datos.setValue(result.getValor(), result.getSerie(), result.getValorEje());
            data.setValue(result.getValorEje(), result.getValor());
        }// w ww .ja v a2  s  .  c om

        //dibujarGrafico(datos, BAR, "Otorgado vs Recuperado", "Moneda", "Monto",PlotOrientation.VERTICAL,pnelOtorgadoRecuperado);

        // Creando el Grafico
        /*JFreeChart grafica = ChartFactory.createPieChart(
         "Prstamos por Estado", 
         data, 
         true, 
         true, 
         false);*/

        JFreeChart grafica = ChartFactory.createPieChart3D("Prstamos por Estado", data, true, true, false);
        grafica.setBackgroundPaint(Color.white);
        PiePlot3D plot = (PiePlot3D) grafica.getPlot();
        plot.setForegroundAlpha(0.6f);
        plot.setCircular(true);
        plot.setLabelGap(0.01);
        plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {1} ({2})"));
        plot.setBackgroundPaint(null);

        // Mostrar Grafico
        ChartPanel panel = new ChartPanel(grafica);
        pnelPorEstado.add(panel);
        pnelPorEstado.revalidate();
        pnelPorEstado.repaint();

    }

}

From source file:com.uttesh.pdfngreport.handler.PdfReportHandler.java

/**
 * This method will generate the chart image file by using the Jfree chart
 * library//from   w w  w.j  ava 2  s  . c o m
 *
 * @param dataSet
 * @throws FileNotFoundException
 * @throws IOException
 *
 * @see DefaultPieDataset
 */
public void generateChart(DefaultPieDataset dataSet, String os) throws FileNotFoundException, IOException {
    try {
        JFreeChart chart = ChartFactory.createPieChart3D("", dataSet, true, true, false);
        ChartStyle.theme(chart);
        PiePlot3D plot = (PiePlot3D) chart.getPlot();
        plot.setForegroundAlpha(0.6f);
        plot.setCircular(true);
        plot.setSectionPaint("Passed", Color.decode("#019244"));
        plot.setSectionPaint("Failed", Color.decode("#EE6044"));
        plot.setSectionPaint("Skipped", Color.decode("#F0AD4E"));
        Color transparent = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        plot.setLabelOutlinePaint(transparent);
        plot.setLabelBackgroundPaint(transparent);
        plot.setLabelShadowPaint(transparent);
        plot.setLabelLinkPaint(Color.GRAY);
        Font font = new Font("SansSerif", Font.PLAIN, 10);
        plot.setLabelFont(font);
        PieSectionLabelGenerator gen = new StandardPieSectionLabelGenerator("{0}: {1} ({2})",
                new DecimalFormat("0"), new DecimalFormat("0%"));
        plot.setLabelGenerator(gen);
        if (os != null && os.equalsIgnoreCase("w")) {
            ChartUtilities.saveChartAsPNG(
                    new File(reportLocation + Constants.BACKWARD_SLASH + Constants.REPORT_CHART_FILE), chart,
                    560, 200);
        } else {
            ChartUtilities.saveChartAsPNG(
                    new File(reportLocation + Constants.FORWARD_SLASH + Constants.REPORT_CHART_FILE), chart,
                    560, 200);
        }
    } catch (Exception e) {
        e.printStackTrace(System.err);
        if (os != null && os.equalsIgnoreCase("w")) {
            new File(reportLocation + Constants.BACKWARD_SLASH + Constants.REPORT_CHART_FILE).delete();
        } else {
            new File(reportLocation + Constants.FORWARD_SLASH + Constants.REPORT_CHART_FILE).delete();
        }
        System.exit(-1);
    }
}

From source file:pidev.presentation.Statistiques.java

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

    String requete = "select Count(id_Agence) from Agence ";
    System.out.println(requete);/* w  ww. j av a2 s . c  o m*/
    try {
        Statement statement = MyConnection.getInstance().createStatement();
        ResultSet resultat = statement.executeQuery(requete);
        while (resultat.next()) {
            nombredagence = resultat.getInt(1);
        }

    } catch (SQLException ex) {
        //Logger.getLogger(PersonneDao.class.getName()).log(Level.SEVERE, null, ex);
        System.out.println("erreur lors du chargement des annonces " + ex.getMessage());

    }
    String requete2 = "select Count(id_Client) from Client ";
    System.out.println(requete2);
    try {
        Statement statement = MyConnection.getInstance().createStatement();
        ResultSet resultat = statement.executeQuery(requete2);
        while (resultat.next()) {
            nombreclient = resultat.getInt(1);
        }

    } catch (SQLException ex) {
        //Logger.getLogger(PersonneDao.class.getName()).log(Level.SEVERE, null, ex);
        System.out.println("erreur lors du chargement des annonces " + ex.getMessage());

    }

    DefaultPieDataset result = new DefaultPieDataset();
    result.setValue("Agences", nombredagence);
    result.setValue("Clients", nombreclient);

    JFreeChart chart = ChartFactory.createPieChart3D("nombre d'agences + nombre de clients", result, true, true,
            false);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);

    ChartFrame ch = new ChartFrame("Statistiques", chart);

    // ChartPanel ch = new ChartPanel(chart);
    ch.setSize(300, 300);
    ch.setLocationRelativeTo(null);
    ch.pack();
    ch.setVisible(true);

}

From source file:UserInterface.ControlManagerRole.ControlManagerWorkAreaJPanel.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    int co2Level = 0;
    int noxLevel = 0;
    int comboBoston = 0;

    int co2Level1 = 0;
    int noxLevel1 = 0;
    int comboNewYork = 0;

    for (Network network : system.getNetworkList()) {
        if (network.getName().equalsIgnoreCase("boston")) {

            for (Customer customer : network.getCustomerDirectory().getCustomerDirectory()) {
                for (Sensor sensor : customer.getSensorDirectory().getSensorDirectory()) {
                    co2Level += sensor.getCurrentEmissionCO2();
                    noxLevel += sensor.getCurrentEmissionNOx();
                }// w w  w .ja  v a 2s .c  o m
            }

        }

    }
    comboBoston = co2Level + noxLevel;

    for (Network network : system.getNetworkList()) {
        if (network.getName().equalsIgnoreCase("New York")) {

            for (Customer customer : network.getCustomerDirectory().getCustomerDirectory()) {
                for (Sensor sensor : customer.getSensorDirectory().getSensorDirectory()) {
                    co2Level1 += sensor.getCurrentEmissionCO2();
                    noxLevel1 += sensor.getCurrentEmissionNOx();
                }

            }

        }
    }
    comboNewYork = co2Level1 + noxLevel1;

    DefaultPieDataset dataset22 = new DefaultPieDataset();
    dataset22.setValue("Fuel Emission by Boston", new Integer(comboBoston));
    dataset22.setValue("Fuel Emission by New York ", new Integer(comboNewYork));

    JFreeChart chart22 = ChartFactory.createPieChart3D("Comparison Chart ", // chart title                   
            dataset22, // data 
            true, // include legend                   
            true, false);

    final PiePlot3D plot = (PiePlot3D) chart22.getPlot();
    plot.setStartAngle(270);
    plot.setForegroundAlpha(0.60f);
    plot.setInteriorGap(0.02);

    ChartFrame frame33 = new ChartFrame("3D Pie Chart for EMission Comparisonbetween two networks", chart22);
    frame33.setVisible(true);
    frame33.setSize(500, 400);

}