Example usage for org.jfree.chart.plot PiePlot3DGradient PiePlot3DGradient

List of usage examples for org.jfree.chart.plot PiePlot3DGradient PiePlot3DGradient

Introduction

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

Prototype

public PiePlot3DGradient(PieDataset dataset) 

Source Link

Document

Creates a plot that will draw a pie chart for the specified dataset.

Usage

From source file:ca.sqlpower.wabit.swingui.chart.ChartSwingUtil.java

/**
 * Creates a chart that displays multiple 3D pie plots that have a GradientPaintTransformer.  
 * The chart object returned by this method uses a {@link MultiplePiePlot} instance as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset (<code>null</code> permitted).
 * @param order  the order that the data is extracted (by row or by column)
 *               (<code>null</code> not permitted).
 * @param legend  include a legend?/*from   w  w w .j a va2s .co  m*/
 * @param tooltips  generate tooltips?
 * @param urls  generate URLs?
 *
 * @return A chart.
 */
private static JFreeChart createPieChart(String title, CategoryDataset dataset, TableOrder order,
        boolean legend, boolean tooltips, boolean urls) {

    if (order == null) {
        throw new IllegalArgumentException("Null 'order' argument.");
    }
    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(order);
    plot.setBackgroundPaint(null);
    plot.setOutlineStroke(null);

    JFreeChart pieChart = new JFreeChart(new PiePlot3DGradient(null));
    TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 10));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(seriesTitle);
    pieChart.getTitle().setPadding(0, 0, 0, 0);
    pieChart.removeLegend();
    pieChart.setBackgroundPaint(null);
    pieChart.setPadding(new RectangleInsets(0, 0, 0, 0));
    pieChart.getPlot().setInsets(new RectangleInsets(0, 0, 0, 0));
    plot.setPieChart(pieChart);

    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setToolTipGenerator(tooltipGenerator);
    }

    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        PiePlot pp = (PiePlot) plot.getPieChart().getPlot();
        pp.setURLGenerator(urlGenerator);
    }

    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    return chart;

}