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.hxzon.demo.jfreechart.PieDatasetDemo2.java

private static JFreeChart createPieChart3D(PieDataset dataset) {

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }/*  ww w  .ja va2s  . c om*/
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart("Pie Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");

    return chart;

}

From source file:de.xirp.chart.ChartManager.java

/**
 * Returns a pie chart. The chart is generated from the given
 * {@link de.xirp.db.Record} and key array. The flag
 * <code>relative</code> indicated whether or not relative
 * values should be used./*from   w  w w . ja v a  2  s  . com*/
 * 
 * @param record
 *            The record containing the data.
 * @param keys
 *            The keys to use.
 * @param relative
 *            Flag indicating if relative values should be used.
 * @return A pie chart.
 * @see org.jfree.chart.JFreeChart
 * @see de.xirp.db.Record
 */
private static JFreeChart createPieChart(Record record, String[] keys, boolean relative) {
    String chartTitle = (relative ? I18n.getString("ChartManager.text.relative") //$NON-NLS-1$
            : I18n.getString("ChartManager.text.absolute")) //$NON-NLS-1$
            + I18n.getString("ChartManager.text.occurencesOfKey") + record.getName() + ": "; //$NON-NLS-1$ //$NON-NLS-2$

    DefaultPieDataset dataset = new DefaultPieDataset();

    Map<String, Long> values;
    values = ChartDatabaseUtil.getValuesForRecord(record, keys, relative);

    for (String s : values.keySet()) {
        dataset.setValue(s, values.get(s));
    }

    JFreeChart chart;
    if (options.is(OptionName.THREE_D)) {
        chart = ChartFactory.createPieChart3D(chartTitle, dataset, true, true, false);

        PiePlot3D plot = (PiePlot3D) chart.getPlot();
        plot.setStartAngle(290);
        plot.setDirection(Rotation.CLOCKWISE);
        plot.setForegroundAlpha(0.5f);
        plot.setNoDataMessage(NO_DATA_AVAILABLE);
        plot.setLabelGenerator(new CustomLabelGenerator(options));
    } else {
        chart = ChartFactory.createPieChart(chartTitle, dataset, true, true, false);

        PiePlot plot = (PiePlot) chart.getPlot();
        plot.setSectionOutlinesVisible(true);
        plot.setNoDataMessage(NO_DATA_AVAILABLE);
        plot.setCircular(false);
        plot.setLabelGap(0.02);
        plot.setLabelGenerator(new CustomLabelGenerator(options));
    }

    exportAutomatically(null, chart);

    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 ww  w.ja va2s  .  c  om*/
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data to display");

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

From source file:net.sf.jasperreports.samples.jfreechart.JFreeChartScriptlet.java

/**
 *
 *//*from w ww .  j  av  a2s.  c o  m*/
public void afterReportInit() throws JRScriptletException {
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue("Java", new Double(43.2));
    dataset.setValue("Visual Basic", new Double(10.0));
    dataset.setValue("C/C++", new Double(17.5));
    dataset.setValue("PHP", new Double(32.5));
    dataset.setValue("Perl", new Double(1.0));

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

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

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

From source file:app.view.panel.PanelCamembert.java

/**
 * Cre le graphique/*from  w  w w  . j a  v  a 2  s . c  o m*/
 *
 * @param dataset Echantillon de donnes
 * @return Graphique
 */
private JFreeChart createChart(PieDataset dataset) {
    final JFreeChart chart = ChartFactory.createPieChart3D("Rpartition gographique", // 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.9f);
    plot.setNoDataMessage("Unlucky donnes ://// gg rito");
    return chart;
}

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

/**
 * Creates a sample chart.//from w w w  .ja  va 2 s  .c o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private JFreeChart createChart(final PieDataset dataset) {

    final JFreeChart chart = ChartFactory.createPieChart3D("Pie Chart 3D Demo 3", // 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(null);
    return chart;

}

From source file:reports.util.PieChart3DScriptlet.java

/**
 *
 *///  w w w . j  a  v  a2s.com
public void afterReportInit() throws JRScriptletException {

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

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

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

From source file:unikn.dbis.univis.visualization.chart.PieChart.java

/**
 * Makes the plot./* www.  jav a  2 s .c o  m*/
 */
protected void plot() {
    PiePlot3D plot = (PiePlot3D) getChart().getPlot();
    plot.setStartAngle(290);
    plot.setDirection(Rotation.CLOCKWISE);
    plot.setForegroundAlpha(0.5f);
    plot.setNoDataMessage("No data available");
    plot.setLabelGenerator(null);
    plot.setLegendLabelGenerator(new LabelGenerator(createTotal()));
}

From source file:aplicacion.gestion.tablero.logic.PieChart3DDemo1.java

/**
 * Creates a sample chart.//  w  w w .jav  a2 s .c o m
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private JFreeChart createChart(final PieDataset dataset) {

    final JFreeChart chart = ChartFactory.createPieChart3D("Pie Chart 3D Demo 1", // 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");
    return chart;

}

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

/**
 * Creates a sample chart./*from w  ww.  java  2s  . c om*/
 *
 * @param dataset the dataset.
 * @return A chart.
 */
private JFreeChart createChart(final PieDataset dataset) {

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

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.yellow);
    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;

}