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

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

Introduction

In this page you can find the example usage for org.jfree.chart.plot PiePlot 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.graphics2d.demo.CanvasPieChartDemo1.java

/**
 * Creates a chart./* w  w w  .j  a v  a 2 s .c  om*/
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {
    JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 1", dataset);
    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");
    return chart;
}

From source file:DataCharts.PieGraph.java

public static JFreeChart createChart(PieDataset dataset) {

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

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("Data Unavailable");
    plot.setCircular(false);/*from   ww w. j  a va 2 s. c o  m*/
    plot.setLabelGap(0.01);
    plot.setBackgroundPaint(null);
    chart.setBorderPaint(null);
    chart.setBackgroundPaint(null);
    return chart;

}

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

private static JFreeChart createChart(PieDataset piedataset) {
    JFreeChart jfreechart = ChartFactory.createPieChart("Legend Wrapper Demo 1", piedataset, false, true,
            false);/*from w  w w  . j a v  a2  s  . c  om*/
    PiePlot pieplot = (PiePlot) jfreechart.getPlot();
    pieplot.setLabelFont(new Font("SansSerif", 0, 12));
    pieplot.setNoDataMessage("No data available");
    pieplot.setCircular(true);
    pieplot.setLabelGap(0.02D);
    LegendTitle legendtitle = new LegendTitle(jfreechart.getPlot());
    BlockContainer blockcontainer = new BlockContainer(new BorderArrangement());
    blockcontainer.setFrame(new BlockBorder(1.0D, 1.0D, 1.0D, 1.0D));
    LabelBlock labelblock = new LabelBlock("Legend Items:", new Font("SansSerif", 1, 12));
    labelblock.setPadding(5D, 5D, 5D, 5D);
    blockcontainer.add(labelblock, RectangleEdge.TOP);
    LabelBlock labelblock1 = new LabelBlock("Source: http://www.jfree.org");
    labelblock1.setPadding(8D, 20D, 2D, 5D);
    blockcontainer.add(labelblock1, RectangleEdge.BOTTOM);
    BlockContainer blockcontainer1 = legendtitle.getItemContainer();
    blockcontainer1.setPadding(2D, 10D, 5D, 2D);
    blockcontainer.add(blockcontainer1);
    legendtitle.setWrapper(blockcontainer);
    legendtitle.setPosition(RectangleEdge.RIGHT);
    legendtitle.setHorizontalAlignment(HorizontalAlignment.LEFT);
    jfreechart.addSubtitle(legendtitle);
    return jfreechart;
}

From source file:thesisdata.PieChartDemo1.java

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

    JFreeChart chart = ChartFactory.createPieChart("Death Causes Detection", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);
    return chart;

}

From source file:view.PieChartDemo1.java

/**
 * Creates a chart./*ww  w  . ja va  2 s .c  o m*/
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */

private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Statics", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");

    return chart;

}

From source file:com.twocents.report.charts.PieChartDemo1.java

/**
 * Creates a chart.// w w w. j av a 2 s  . c o m
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

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

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");

    return chart;

}

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

/**
 * Creates a chart./*w w w . j a v  a 2s.  c  om*/
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

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

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);
    return chart;

}

From source file:org.hxzon.demo.jfreechart.PieDatasetDemo.java

private static JFreeChart createPieChart(PieDataset dataset, PieDataset previousDataset) {
    //        createPieChart(String title,
    //                PieDataset dataset,
    //                PieDataset previousDataset,
    //                int percentDiffForMaxScale,
    //                boolean greenForIncrease,
    //                boolean legend,
    //                boolean tooltips,
    //                boolean urls,
    //                boolean subTitle,
    //                boolean showDifference)
    JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 2", // chart title
            dataset, // data
            previousDataset, 0, // percentDiffForMaxScale
            true, // greenForIncrease
            true, // include legend
            true, // tooltips
            false, // urls
            true, // subTitle
            true); // showDifference

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setNoDataMessage("No data available");

    return chart;

}

From source file:com.mxgraph.examples.swing.chart.PieChartDemo1.java

/**
 * Creates a chart./*from w ww .j  a  va 2s. co m*/
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
public static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot plot = (PiePlot) chart.getPlot();

    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");

    plot.setCircular(true);
    plot.setLabelGap(0.01D);//
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}:\r\n{1}({2})",
            NumberFormat.getNumberInstance(), new DecimalFormat("0.00%"))); //  //
    plot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}({2})"));

    chart.getTitle().setFont(new Font("", Font.PLAIN, 20));//
    PiePlot piePlot = (PiePlot) chart.getPlot();//
    piePlot.setLabelFont(new Font("", Font.PLAIN, 10));
    chart.getLegend().setItemFont(new Font("", Font.PLAIN, 10));

    return chart;

}

From source file:fitmon.PieChart.java

/**
 * Creates a chart.//  w ww. j  a v  a2 s .c  om
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
public static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Food Stat of the Week", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);
    return chart;

}