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

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

Introduction

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

Prototype

public void setLabelGap(double gap) 

Source Link

Document

Sets the gap between the edge of the pie and the labels (expressed as a percentage of the plot width) and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:msi.gama.outputs.layers.ChartLayerStatement.java

private void createSlices(final IScope scope) throws GamaRuntimeException {
    int i = 0;/*from   w w  w  .  j a v  a  2s .c om*/
    dataset = new DefaultPieDataset();
    final PiePlot plot = (PiePlot) chart.getPlot();
    for (final ChartData e : datas) {
        final String legend = e.getName();
        ((DefaultPieDataset) dataset).insertValue(i++, legend, null);
        history.append(legend);
        history.append(',');
    }
    if (history.length() > 0) {
        history.deleteCharAt(history.length() - 1);
    }
    history.append(Strings.LN);
    plot.setDataset((DefaultPieDataset) dataset);
    i = 0;
    for (final ChartData e : datas) {
        plot.setSectionPaint(i++, e.getColor());
    }
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} = {1} ({2})"));
    if (exploded) {
        for (final Object c : ((DefaultPieDataset) dataset).getKeys()) {
            plot.setExplodePercent((Comparable) c, 0.20);
        }
    }
    plot.setSectionOutlinesVisible(false);
    plot.setLabelFont(getLabelFont());
    plot.setNoDataMessage("No data available yet");
    plot.setCircular(true);
    plot.setLabelGap(0.02);
    plot.setInteriorGap(0);
}