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

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

Introduction

In this page you can find the example usage for org.jfree.chart.plot RingPlot setExplodePercent.

Prototype

public void setExplodePercent(Comparable key, double percent) 

Source Link

Document

Sets the amount that a pie section should be exploded and sends a PlotChangeEvent to all registered listeners.

Usage

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

/**
 * Creates a chart./*from   w  ww .  jav a2  s .c om*/
 * 
 * @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;

}