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

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

Introduction

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

private static JFreeChart createChart(PieDataset piedataset) {
    JFreeChart jfreechart = ChartFactory.createRingChart("Ring Chart Demo 1", piedataset, false, true, false);
    RingPlot ringplot = (RingPlot) jfreechart.getPlot();
    ringplot.setLabelFont(new Font("SansSerif", 0, 12));
    ringplot.setNoDataMessage("No data available");
    ringplot.setSectionDepth(0.34999999999999998D);
    ringplot.setCircular(false);// www . j  ava  2  s.c o m
    ringplot.setLabelGap(0.02D);
    return jfreechart;
}

From source file:eu.delving.sip.base.ReportChartHelper.java

public static JComponent createLinkChart(DataSet dataSet, String prefix,
        Map<RecDef.Check, LinkFile.LinkStats> linkStatsMap) {
    JPanel p = new JPanel(new GridLayout(0, 1));
    for (Map.Entry<RecDef.Check, LinkFile.LinkStats> entry : linkStatsMap.entrySet()) {
        JPanel pp = new JPanel(new GridLayout(1, 0));
        pp.setBorder(BorderFactory.createTitledBorder(entry.getKey().toString()));
        for (Map.Entry<String, PieDataset> datasetEntry : entry.getValue().createPies().entrySet()) {
            JFreeChart chart = ChartFactory.createRingChart(datasetEntry.getKey(), datasetEntry.getValue(),
                    true, false, Locale.getDefault());
            RingPlot plot = (RingPlot) chart.getPlot();
            plot.setLabelGenerator(null);
            plot.setNoDataMessage("No data available");
            plot.setSectionDepth(0.34999999999999998D);
            plot.setCircular(true);/*from w  w  w.j a  v  a2s  .  c  o  m*/
            plot.setLabelGap(0.02D);
            pp.add(new ChartPanel(chart));
        }
        p.add(pp);
    }
    return p;
}

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

private static JFreeChart createRingChart(PieDataset dataset) {

    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator());
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }/*  www.j ava 2  s  . c om*/
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart("Ring Chart Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");

    return chart;

}

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

/**
 * Creates a chart.//www.j av a2s  .c o  m
 * 
 * @param dataset  the dataset.
 * 
 * @return a chart.
 */
protected JFreeChart createChart(PieDataset dataset) {

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

    RingPlot plot = (RingPlot) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);
    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;

}

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

/**
 * Makes the plot./*  ww w .  j a  v a  2  s .c o  m*/
 */
protected void plot() {
    RingPlot plot = (RingPlot) 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()));
}