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

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

Introduction

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

Prototype

public void setNoDataMessage(String message) 

Source Link

Document

Sets the message that is displayed when the dataset is empty or null, and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.PieChart3DDemo4.java

/**
 * Creates a sample chart.//from   w  w w. j av  a2 s . com
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private JFreeChart createChart(final PieDataset dataset) {

    final JFreeChart chart = ChartFactory.createPieChart3D("Pie Chart 3D Demo 4", // chart title
            dataset, // data
            true, // include legend
            true, false);

    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.pentaho.reporting.engine.classic.demo.ancient.demo.chartdemo.MultiAPIChartDemo.java

/**
 * Creates a sample chart.//  w  w  w . j  av a  2 s  .c om
 *
 * @return A chart.
 */
private JFreeChart createChart(final int year) {

    final JFreeChart chart = ChartFactory.createPieChart3D("Programming Language of the Year " + year, // chart title
            createSampleDataset(), // data
            true, // include legend
            true, false);

    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
    //    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

}

From source file:edu.ucla.stat.SOCR.chart.demo.PieChart3DDemo3.java

/**
 * Creates a sample chart./*from w  w  w. j av a2  s. c om*/
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
protected JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart3D(chartTitle, // chart title
            dataset, // data
            !legendPanelOn, // 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");
    plot.setLabelGenerator(new CustomPieSectionLabelGenerator());

    for (int i = 0; i < pulloutFlag.length; i++) {
        //System.out.println("\""+pulloutFlag[i]+"\"");
        if (pulloutFlag[i].equals("1")) {
            Comparable key = dataset.getKey(i);
            plot.setExplodePercent(key, 0.30);
        }
    }
    if (rotateOn) {
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }
    setCategorySummary(dataset);
    return chart;

}

From source file:kcse_2013_results.Pie_Chart_KCSE_School_Performance.java

/**
 * Creates a chart.// ww  w  .j a  v  a2s.  com
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
public JFreeChart createChart(PieDataset dataset) {
    JFreeChart chart = ChartFactory.createPieChart3D("KCSE 2013 Results Summary ", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setForegroundAlpha(0.95f);
    plot.setCircular(true);
    plot.setLabelGap(0.02);
    return chart;

}

From source file:org.pentaho.reporting.engine.classic.demo.ancient.demo.chartdemo.TableJFreeChartDemo.java

/**
 * Creates a sample chart.//  w w w .j  av a  2s  .  co m
 *
 * @return A chart.
 */
private JFreeChart createChart(final int year, final int[] votes) {

    final JFreeChart chart = ChartFactory.createPieChart3D("Programming Language of the Year " + (year), // chart title
            createSampleDataset(votes), // data
            true, // include legend
            true, false);

    // set the background color for the chart...
    final PiePlot3D plot = (PiePlot3D) chart.getPlot();
    plot.setStartAngle(270);
    //    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

    return chart;

}

From source file:bzstats.chart.KillRatioChart.java

/**
 * @see bzstats.chart.ChartFactory#getChart()
 */// w w w  . ja va 2  s.  co  m
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:taller.GraficoTorta.java

public GraficoTorta(int posX, int posY, double[] datos, String[] labels, String titulo) {

    super("");
    try {/*ww w. ja v  a  2s .  c o  m*/

        DefaultPieDataset defaultpiedataset = new DefaultPieDataset();

        for (int i = 0; i < datos.length; i++)
            defaultpiedataset.setValue(labels[i], datos[i]);

        JFreeChart jfreechart = ChartFactory.createPieChart3D(titulo, defaultpiedataset, true, true, false);
        PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
        pieplot3d.setDarkerSides(true);
        pieplot3d.setStartAngle(0D);
        pieplot3d.setDirection(Rotation.CLOCKWISE);
        pieplot3d.setForegroundAlpha(0.75F);
        pieplot3d.setNoDataMessage("No hay Datos que Mostrar");

        jpanel = new ChartPanel(jfreechart);
        jpanel.setPreferredSize(new Dimension(300, 300));
        setContentPane(jpanel);
        pack();
        RefineryUtilities.centerFrameOnScreen(this);
    } catch (Exception e) {
    }
}

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   w w  w  .  java2s. c  o  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);//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:vn.edu.vttu.ui.PanelStatiticsService.java

private void showChart() {
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    DefaultPieDataset dataset = new DefaultPieDataset();
    int row = tbResult.getRowCount();
    for (int i = 0; i < row; i++) {
        totalNumber = totalNumber + Integer.parseInt(String.valueOf(tbResult.getValueAt(i, 3)));
    }/* w  ww . jav  a2  s.  c  o  m*/
    for (int i = 0; i < row; i++) {
        double value = 0;
        try {
            try {
                value = Double
                        .parseDouble(String.valueOf(tbResult.getValueAt(i, 3)).trim().replaceAll("\\.", ""));
            } catch (Exception e) {
                value = Double
                        .parseDouble(String.valueOf(tbResult.getValueAt(i, 3)).trim().replaceAll(",", ""));
            }
        } catch (Exception e) {
            value = 0;
        }
        String name = String.valueOf(tbResult.getValueAt(i, 1)).trim();
        DecimalFormat df = new DecimalFormat("###,##");
        value = (value / totalNumber) * 100;
        System.out.println(totalNumber);
        dataset.setValue(name, value);
    }

    JFreeChart chart = ChartFactory.createPieChart3D("TH?NG K T L S DNG DCH V", dataset,
            true, true, true);
    PiePlot3D p = (PiePlot3D) chart.getPlot();
    p.setNoDataMessage("Khng c d liu thng k");
    ChartPanel CP = new ChartPanel(chart);
    pnChart.removeAll();
    pnChart.add(CP);
    pnChart.updateUI();
    pnChart.repaint();
    //ChartFrame frame = new ChartFrame("Thng k doanh thu", chart);
    //frame.setSize(450, 350);
    //frame.setVisible(true);
}