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

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

Introduction

In this page you can find the example usage for org.jfree.chart.plot PiePlot setNoDataMessageFont.

Prototype

public void setNoDataMessageFont(Font font) 

Source Link

Document

Sets the font used to display the 'no data' message and sends a PlotChangeEvent to all registered listeners.

Usage

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

/**
 * Default constructor.//  w w w  . ja  va2s.  c om
 *
 * @param title  the frame title.
 */
public PieChartDemo3(final String title) {

    super(title);

    // create a dataset...
    final DefaultPieDataset data = new DefaultPieDataset();

    // create the chart...
    final JFreeChart chart = ChartFactory.createPieChart("Pie Chart Demo 3", // chart title
            data, // data
            true, // include legend
            true, false);

    final PiePlot plot = (PiePlot) chart.getPlot();
    plot.setNoDataMessage("No data available");
    plot.setNoDataMessageFont(new Font("Serif", Font.ITALIC, 10));
    plot.setNoDataMessagePaint(Color.red);

    // add the chart to a panel...
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

}

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

/**
 * Creates a demo chart.//from   w  ww .  j av  a  2 s .  co m
 * 
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
protected JFreeChart createChart(PieDataset dataset) {
    dataset = null;

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

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setNoDataMessage("No data available so we go into this really "
            + "long spiel about what that means and it runs off the end of the "
            + "line but what can you do about that!");
    plot.setNoDataMessageFont(new Font("Serif", Font.ITALIC, 10));
    plot.setNoDataMessagePaint(Color.red);
    for (int i = 0; i < pulloutFlag.length; i++) {
        //System.out.println("\""+pulloutFlag[i]+"\"");
        if (isPullout(i)) {
            Comparable key = dataset.getKey(i);
            plot.setExplodePercent(key, 0.30);
        }
    }

    if (rotateOn) {
        Rotator rotator = new Rotator(plot);
        rotator.start();
    }

    setCategorySummary(dataset);
    return chart;
}