Example usage for org.jfree.chart.labels StandardPieItemLabelGenerator StandardPieItemLabelGenerator

List of usage examples for org.jfree.chart.labels StandardPieItemLabelGenerator StandardPieItemLabelGenerator

Introduction

In this page you can find the example usage for org.jfree.chart.labels StandardPieItemLabelGenerator StandardPieItemLabelGenerator.

Prototype

public StandardPieItemLabelGenerator(String labelFormat) 

Source Link

Document

Creates an item label generator.

Usage

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

/**
 * Creates a sample chart with the given dataset.
 * /* w  w  w  . j  a  v  a2 s . co  m*/
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {
    final JFreeChart chart = ChartFactory.createMultiplePieChart("Multiple Pie Chart", // chart title
            dataset, // dataset
            TableOrder.BY_ROW, true, // include legend
            true, false);
    final MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot();
    final JFreeChart subchart = plot.getPieChart();
    final PiePlot p = (PiePlot) subchart.getPlot();
    p.setLabelGenerator(new StandardPieItemLabelGenerator("{0}"));
    p.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    p.setInteriorGap(0.30);

    return chart;
}

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

/**
 * Creates a sample chart with the given dataset.
 * //from  www .jav  a 2  s.c  om
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {
    final JFreeChart chart = ChartFactory.createMultiplePieChart("Multiple Pie Chart", // chart title
            dataset, // dataset
            TableOrder.BY_ROW, true, // include legend
            true, true);
    final MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot();
    final JFreeChart subchart = plot.getPieChart();
    final PiePlot p = (PiePlot) subchart.getPlot();
    p.setLabelGenerator(new StandardPieItemLabelGenerator("{0}"));
    p.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    p.setInteriorGap(0.30);

    return chart;
}

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

/**
 * Creates a sample chart for the given dataset.
 * //  w  w  w  .j  a  va2s . com
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private JFreeChart createChart(final CategoryDataset dataset) {
    final JFreeChart chart = ChartFactory.createMultiplePieChart3D("Multiple Pie Chart Demo 4", dataset,
            TableOrder.BY_COLUMN, false, true, false);
    chart.setBackgroundPaint(new Color(216, 255, 216));
    final MultiplePiePlot plot = (MultiplePiePlot) chart.getPlot();
    final JFreeChart subchart = plot.getPieChart();
    //        final StandardLegend legend = new StandardLegend();
    //      legend.setItemFont(new Font("SansSerif", Font.PLAIN, 8));
    //    legend.setAnchor(Legend.SOUTH);
    //  subchart.setLegend(legend);
    plot.setLimit(0.10);
    final PiePlot p = (PiePlot) subchart.getPlot();
    p.setLabelGenerator(new StandardPieItemLabelGenerator("{0}"));
    p.setLabelFont(new Font("SansSerif", Font.PLAIN, 8));
    p.setInteriorGap(0.30);

    return chart;
}