Example usage for org.jfree.chart ChartFactory createPieChart3D

List of usage examples for org.jfree.chart ChartFactory createPieChart3D

Introduction

In this page you can find the example usage for org.jfree.chart ChartFactory createPieChart3D.

Prototype

public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend, boolean tooltips,
        boolean urls) 

Source Link

Document

Creates a 3D pie chart using the specified dataset.

Usage

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  ww w.j  a va2 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:Controller.PieChart.java

/**
     * Creates a chart/*ww w .ja va2s .  com*/
     */

private JFreeChart createChart(PieDataset dataset, String title) {

    JFreeChart chart = ChartFactory.createPieChart3D(title, // 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);
    return chart;

}

From source file:GUI.meilleurePrestataire.java

public meilleurePrestataire() throws SQLException {

    dataset = new DefaultPieDataset();
    Connection connexion = MyConnection.getInstance();
    String requete = "select * from evaluationprestataire";
    Statement statement = connexion.createStatement();
    ResultSet resultat = statement.executeQuery(requete);
    while (resultat.next()) {

        dataset.setValue(/*  w  ww .ja  v a 2s .c  o  m*/
                userDAO.retrieveUtilisateurById(resultat.getInt(2)).getNom() + " : " + resultat.getInt(3),
                resultat.getInt(3));

    }
    graphe = ChartFactory.createPieChart3D("Les notes des prestataires", dataset, true, true, false);
    cp = new ChartPanel(graphe);
    this.add(cp);
}

From source file:org.codehaus.mojo.dashboard.report.plugin.chart.PieChart3DRenderer.java

public void createChart() {
    PieDataset dataset = (PieDataset) this.datasetStrategy.getDataset();
    report = ChartFactory.createPieChart3D(this.datasetStrategy.getTitle(), dataset, false, true, true);

    PiePlot3D plot3D = (PiePlot3D) report.getPlot();
    plot3D.setDirection(Rotation.ANTICLOCKWISE);
    plot3D.setStartAngle(PieChart3DRenderer.START_ANGLE);
    plot3D.setForegroundAlpha(PieChart3DRenderer.FOREGROUND_ALPHA);
    plot3D.setLabelFont(new Font("Lucida", 0, PieChart3DRenderer.FONT_SIZE));

}

From source file:WeeklyReport.Sections.Declines.java

private JFreeChart declinesByReasonChart() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    Map<Double, String> mp = DECLINES_BY_REASON;
    mp.entrySet().stream().forEach((mapEntry) -> {
        dataset.setValue(mapEntry.getValue(), mapEntry.getKey());
    });/* w  ww  .j  av a2 s .c o m*/
    JFreeChart pieChart = ChartFactory.createPieChart3D("Reason for Decline by total CBM", dataset, true, true,
            false);
    Plot plot = pieChart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    return pieChart;
}

From source file:GUI.BonDeLavageStats.java

/**
 * Creates a chart//from  www.  j a  v  a 2 s  . com
 */
private JFreeChart createChart(PieDataset dataset, String title) {

    JFreeChart chart = ChartFactory.createPieChart3D(title, // 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);
    return chart;

}

From source file:JFreeChartScriptlet.java

@Override
public void afterReportInit() throws JRScriptletException {
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue("Java", 43.2d);
    dataset.setValue("Visual Basic", 10.0d);
    dataset.setValue("C/C++", 17.5d);
    dataset.setValue("PHP", 32.5d);
    dataset.setValue("Perl", 1.0d);

    JFreeChart chart = ChartFactory.createPieChart3D("Pie Chart 3D Demo 1", dataset, true, true, false);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(290);/*from  w  ww  .  j  a v  a2  s.  co  m*/
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    /*   */
    this.setVariableValue("Chart", new JCommonDrawableRendererImpl(chart));
}

From source file:bzstats.chart.KillRatioChart.java

/**
 * @see bzstats.chart.ChartFactory#getChart()
 *//*from  w w w.ja  v a2  s. c  om*/
protected JFreeChart getChart() {

    DefaultPieDataset dataset = new DefaultPieDataset();

    Iterator playeriter = stats.getPlayerStats().values().iterator();

    PlayerStats player;
    int playercount = 0;
    while (playeriter.hasNext() && (playercount++ < MAXPLAYERS)) {
        player = (PlayerStats) playeriter.next();
        dataset.setValue(player.getName(), player.getKillRatio());
    }

    //       create chart and plot
    JFreeChart chart = ChartFactory.createPieChart3D("Killratio", // chart title
            dataset, // data
            false, // include legend
            true, false);

    chart.addSubtitle(new TextTitle("kills/deaths"));

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

    return chart;
}

From source file:cz.zcu.kiv.eegdatabase.wui.components.utils.ChartUtils.java

public static BufferedImage gererateChartForTopDownloadHistory(ChoiceHistory choiceHistory,
        boolean generateEmptyGraph, List<DownloadStatistic> topDownloadedFilesList, long countOfFilesHistory) {

    long countFile = 0;

    DefaultPieDataset dataset = new DefaultPieDataset();
    if (!generateEmptyGraph && topDownloadedFilesList != null) {
        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();
        }/* w ww  .jav a  2s.c o  m*/

        if (countOfFilesHistory > countFile) {
            dataset.setValue("Other", countOfFilesHistory - countFile);
        }
    }

    String chartTitle = ResourceUtils.getString("title.dailyStatistic");
    if (choiceHistory == ChoiceHistory.WEEKLY) {
        chartTitle = ResourceUtils.getString("title.weeklyStatistic");

    } else if (choiceHistory == ChoiceHistory.MONTHLY) {
        chartTitle = ResourceUtils.getString("title.monthlyStatistic");
    }

    JFreeChart chart = ChartFactory.createPieChart3D(chartTitle, // 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(ResourceUtils.getString("label.noDataMessage"));

    return chart.createBufferedImage(600, 400);
}

From source file:com.pureinfo.srm.reports.impl.PieChartBuilder.java

/**
 * @throws PureException/*from   w  w  w  .j  a va 2  s. co  m*/
 * @see com.pureinfo.srm.reports.IChartBuilder#draw(java.util.List, int)
 */
public JFreeChart buildChart() {
    Iterator result = m_datas.iterator();
    DefaultPieDataset ds = getDataset(result);

    JFreeChart jfreechart = ChartFactory.createPieChart3D(null, ds, false, false, false);
    jfreechart.setBackgroundPaint(Color.WHITE);

    PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    pieplot3d.setOutlinePaint(Color.GRAY);
    pieplot3d.setOutlineStroke(new BasicStroke(1));
    pieplot3d.setStartAngle(30D);
    pieplot3d.setDepthFactor(0.04);
    pieplot3d.setDrawingSupplier(new DefaultDrawingSupplier(MyPaintMgr.getPaints(),
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    pieplot3d.setCircular(false);
    pieplot3d.setDirection(Rotation.CLOCKWISE);
    pieplot3d.setOutlinePaint(Color.WHITE);
    pieplot3d.setInteriorGap(.15);
    Color color = new Color(0xaa, 0xaa, 0xaa, 255);
    pieplot3d.setBaseSectionOutlinePaint(color);
    pieplot3d.setBaseSectionOutlineStroke(new BasicStroke(0));
    pieplot3d.setForegroundAlpha(0.6f);
    pieplot3d.setLabelLinkStroke(new BasicStroke(1));
    pieplot3d.setLabelOutlinePaint(new Color(0x777777));
    pieplot3d.setLabelBackgroundPaint(new Color(0xf1f1f7));
    pieplot3d.setLabelLinkPaint(new Color(0xaa, 0xaa, 0xaa, 60));
    pieplot3d.setNoDataMessage("No data to display");
    pieplot3d.setLabelShadowPaint(new Color(0xdddddd));
    pieplot3d.setLabelFont(new Font("", Font.PLAIN, 10));
    if (m_nType == TYPE_PERCENT) {

        pieplot3d.setLabelGenerator(new StandardPieItemLabelGenerator("{0} = {2}",
                NumberFormat.getNumberInstance(), PERCENT_NUMBER_FORMAT));
    }

    fillChartInfo(ds);
    return jfreechart;
}