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

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

Introduction

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

Prototype

public PiePlot3D(PieDataset dataset) 

Source Link

Document

Creates a pie chart with a three dimensional effect using the specified dataset.

Usage

From source file:org.shredzone.bullshitcharts.chart.AgreementPieGenerator.java

@Override
public Plot generate() {
    PieDatasetCreator dataset = new PieDatasetCreator();
    dataset.addChoice("disagree"); // TODO: i18n
    dataset.addChoice("indecisive");
    dataset.addChoice("agree");

    dataset.setFavouriteChoice("agree");
    dataset.setObnoxiousChoice("disagree");
    dataset.setTendency(getTendency());/* ww  w .  j a va 2  s . co  m*/

    PiePlot3D plot = new PiePlot3D(dataset.generate());
    plot.setCircular(true);
    plot.setStartAngle(110d);
    plot.setForegroundAlpha(0.6f);
    plot.setDarkerSides(true);
    plot.setOutlineVisible(false);
    return plot;
}

From source file:org.shredzone.bullshitcharts.chart.ChoicePieGenerator.java

@Override
public Plot generate() {
    PieDatasetCreator dataset = new PieDatasetCreator();

    String choice1 = getValue("c1", "");
    String choice2 = getValue("c2", null);
    String choice3 = getValue("c3", null);
    String choice4 = getValue("c4", null);
    String choice5 = getValue("c5", null);

    dataset.addChoice(choice1);//from w  w w  . ja  va  2  s . c  o m
    dataset.setFavouriteChoice(choice1);
    if (choice2 != null)
        dataset.addChoice(choice2);
    if (choice3 != null)
        dataset.addChoice(choice3);
    if (choice4 != null)
        dataset.addChoice(choice4);
    if (choice5 != null)
        dataset.addChoice(choice5);

    dataset.setTendency(getTendency());

    PiePlot3D plot = new PiePlot3D(dataset.generate());
    plot.setCircular(true);
    plot.setStartAngle(110d);
    plot.setForegroundAlpha(0.6f);
    plot.setDarkerSides(true);
    plot.setOutlineVisible(false);
    return plot;
}

From source file:com.ewcms.plugin.report.generate.service.chart.ChartGenerationService.java

/**
 * 3D/*from w ww .  j  a v a  2s  . c  o m*/
 *
 * @param title 
 * @param titleFont 
 * @param data ??
 * @param order
 * @param legend 
 * @param tooltips ????
 * @param urls ??URL
 * @param urlGenerator
 *
 * @return 
 */
public static JFreeChart create3DPieChart(String title, java.awt.Font titleFont, CategoryDataset data,
        TableOrder order, boolean legend, boolean tooltips, boolean urls, PieURLGenerator urlGenerator) {

    MultiplePiePlot plot = new MultiplePiePlot(data);
    plot.setDataExtractOrder(order);

    // plot.setOutlineStroke(null);

    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    pieChart.setBackgroundPaint(null);
    plot.setPieChart(pieChart);

    PiePlot3D pp = (PiePlot3D) plot.getPieChart().getPlot();
    pp.setBackgroundPaint(null);
    // pp.setInsets(new Insets(0, 5, 5, 5));

    pp.setOutlineStroke(null);

    PieToolTipGenerator tooltipGenerator = null;
    if (tooltips) {
        tooltipGenerator = new StandardPieToolTipGenerator();
    }

    if (!urls) {
        urlGenerator = null;
    }

    pp.setToolTipGenerator(tooltipGenerator);
    pp.setLabelGenerator(null);
    pp.setURLGenerator(urlGenerator);
    JFreeChart chart = new JFreeChart(title, titleFont, plot, legend);

    return chart;
}

From source file:com.tonbeller.jpivot.chart.ChartFactory.java

/**
 * Creates a sample dataset for the demo.
 * /*from  w  w  w  .  j av a  2s  .  com*/
 * @return A sample dataset.
 */
public static JFreeChart create3DPieChart(String title, java.awt.Font titleFont, CategoryDataset data,
        TableOrder order, boolean legend, boolean tooltips, boolean urls, PieURLGenerator urlGenerator) {

    MultiplePiePlot plot = new MultiplePiePlot(data);
    plot.setDataExtractOrder(order);

    //plot.setOutlineStroke(null);

    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    pieChart.setBackgroundPaint(null);
    plot.setPieChart(pieChart);

    PiePlot3D pp = (PiePlot3D) plot.getPieChart().getPlot();
    pp.setBackgroundPaint(null);
    //pp.setInsets(new Insets(0, 5, 5, 5));

    // no outline around each piechart
    pp.setOutlineStroke(null);

    PieToolTipGenerator tooltipGenerator = null;
    if (tooltips) {
        tooltipGenerator = new StandardPieToolTipGenerator();
    }

    if (!urls) {
        urlGenerator = null;
    }

    pp.setToolTipGenerator(tooltipGenerator);
    pp.setLabelGenerator(null);
    pp.setURLGenerator(urlGenerator);
    JFreeChart chart = new JFreeChart(title, titleFont, plot, legend);

    return chart;

}

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

private static JFreeChart createPieChart3D(PieDataset dataset) {

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    if (tooltips) {
        plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    }/*from ww  w.j  av  a  2s.  co m*/
    if (urls) {
        plot.setURLGenerator(new StandardPieURLGenerator());
    }
    JFreeChart chart = new JFreeChart("Pie Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    plot.setSectionOutlinesVisible(false);
    plot.setNoDataMessage("No data available");

    return chart;

}

From source file:com.estate.pdf.Page.java

protected void drawTaxPie(Rectangle rct, double totalValue, double tax, String taxLabel, String netLabel) {
    double taxPercent = (tax / totalValue) * 100;
    double netValuePercent = 100 - taxPercent;

    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue(taxLabel, taxPercent);
    dataset.setValue(netLabel, netValuePercent);

    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setLabelGenerator(new StandardPieItemLabelGenerator());
    plot.setInsets(new Insets(0, 5, 5, 5));
    plot.setToolTipGenerator(new CustomeGenerators.CustomToolTipGenerator());
    plot.setLabelGenerator(new CustomeGenerators.CustomLabelGenerator());
    plot.setSectionPaint(0, new Color(pgRed));
    plot.setSectionPaint(1, new Color(pgGreen));
    plot.setForegroundAlpha(.6f);//ww w.j  av  a  2  s  .  c  om
    plot.setOutlinePaint(Color.white);
    plot.setBackgroundPaint(Color.white);

    JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);

    Rectangle page = rct;

    try {
        Image img = Image.getInstance(chart.createBufferedImage((int) page.getWidth(), (int) page.getHeight()),
                null);
        drawDiagram(img, rct, 0, 72);
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }

}

From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHandler.java

protected JFreeChart createCharts(ChartPanel chartPanel, ChartDefinition cd) {
    List<DataSetValue> datasets = createDataSets(cd);
    int len = datasets.size();
    UIFont f = getAxisLabelFont(cd.getRangeAxis());
    UIFontMetrics fm = UIFontMetrics.getMetrics(f);

    tickSize = (int) fm.getHeight();

    if (cd.getChartType() == ChartType.PIE) {
        PiePlot plot;//from ww w . j a va 2 s.  co m
        PieCollection pie = (PieCollection) datasets.get(0).dataset;

        if (cd.isDraw3D()) {
            plot = new PiePlot3D(pie);
        } else {
            plot = new PiePlot(pie);
        }

        customizePiePlot(cd, plot, pie);

        return new JFreeChart(null, getChartFont(), plot, false);
    }

    ChartInfo ci = (ChartInfo) cd.getChartHandlerInfo();
    XYPlot xyplot = null;
    NumberAxis yAxis = cd.isDraw3D() ? new NumberAxis3DEx(cd, true, cd.getRangeLabel())
            : new NumberAxisEx(cd, false, cd.getRangeLabel());

    yAxis.setAutoRangeIncludesZero(false);
    yAxis.setAutoRange(false);

    NumberAxis xAxis;

    if (ci.categoryDomain) {
        LabelData[] labels = ci.createLabelData(cd, fm, true);

        xAxis = cd.isDraw3D() ? new NumberAxis3DEx(cd, true, cd.getDomainLabel())
                : new NumberAxisEx(cd, labels, cd.getDomainLabel());
    } else {
        xAxis = cd.isDraw3D() ? new NumberAxis3DEx(cd, true, cd.getDomainLabel())
                : new NumberAxisEx(cd, true, cd.getDomainLabel());
    }

    xAxis.setAutoRangeIncludesZero(false);
    xAxis.setAutoRange(false);
    xyplot = new XYPlotEx(null, xAxis, yAxis, null);

    for (int i = 0; i < len; i++) {
        DataSetValue dv = datasets.get(i);

        xyplot.setDataset(i, (XYDataset) dv.dataset);

        switch (dv.chartType) {
        case SPLINE:
            xyplot.setRenderer(i, new XYSplineRendererEx(ci.seriesData));

            break;

        case LINE:
            xyplot.setRenderer(i, cd.isDraw3D() ? new XYLine3DRendererEx(ci.seriesData)
                    : new XYLineAndShapeRendererEx(ci.seriesData));

            break;

        case BAR: {
            XYClusteredBarRendererEx renderer = new XYClusteredBarRendererEx(ci.seriesData);

            renderer.setShadowVisible(false);
            xyplot.setRenderer(i, renderer);
        }

            break;

        case STACKED_BAR: {
            StackedXYBarRenderer renderer = new XYStackedBarRendererEx(0.10, ci.seriesData);

            renderer.setDrawBarOutline(false);
            renderer.setShadowVisible(false);
            xyplot.setRenderer(i, renderer);
        }

            break;

        case RANGE_AREA:
            xyplot.setRenderer(i, new XYRangeAreaRendererEx(ci.seriesData));

            break;

        case RANGE_BAR:
            xyplot.setRenderer(i, new XYRangeBarRendererEx(ci.seriesData));

            break;

        case STACKED_AREA:
            XYStackedAreaRendererEx renderer = new XYStackedAreaRendererEx(ci.seriesData);

            renderer.setOutline(false);
            xyplot.setRenderer(i, renderer);

            break;

        case SPLINE_AREA:
        case AREA:
            XYItemRenderer r;

            if (dv.chartType == ChartType.SPLINE_AREA) {
                r = new XYAreaSplineRendererEx(ci.seriesData);
            } else {
                r = new XYAreaRendererEx(ci.seriesData);
            }

            xyplot.setRenderer(r);

            break;

        default:
            throw new InvalidParameterException("Unsupported chart type");
        }
    }

    customizeXYPlot(chartPanel, cd, xyplot);

    JFreeChart chart = new JFreeChart(null, getChartFont(), xyplot, false);

    return chart;
}

From source file:org.pentaho.platform.uifoundation.chart.JFreeChartEngine.java

private static JFreeChart createPieDatasetChart(final PieDatasetChartDefinition chartDefinition) {
    // TODO Make the following accessible from the chartDefinition
    boolean tooltips = true;
    boolean urls = true;
    // -----------------------------------------------------------

    String title = chartDefinition.getTitle();
    boolean legend = chartDefinition.isLegendIncluded();

    PiePlot plot = null;//www  .j a v  a2 s  .  co m
    plot = chartDefinition.isThreeD() ? new PiePlot3D(chartDefinition) : new PiePlot(chartDefinition);
    JFreeChartEngine.updatePlot(plot, chartDefinition);
    JFreeChart pieChart = new JFreeChart(title, chartDefinition.getTitleFont(), plot, legend);
    TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); //$NON-NLS-1$ //$NON-NLS-2$
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(title);
    pieChart.setBackgroundPaint(chartDefinition.getChartBackgroundPaint());

    if (tooltips) {
        PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator();
        plot.setToolTipGenerator(tooltipGenerator);
    }

    if (urls) {
        PieURLGenerator urlGenerator = new StandardPieURLGenerator();
        plot.setURLGenerator(urlGenerator);
    }

    return pieChart;
}

From source file:org.orbeon.oxf.processor.serializer.legacy.JFreeChartSerializer.java

protected JFreeChart drawChart(ChartConfig chartConfig, final Dataset ds) {
    JFreeChart chart = null;//from w w  w  . ja va 2s .c om
    Axis categoryAxis = null;
    if (ds instanceof XYSeriesCollection) {
        categoryAxis = new RestrictedNumberAxis(chartConfig.getCategoryTitle());
    } else if (ds instanceof TimeSeriesCollection) {
        categoryAxis = new DateAxis(chartConfig.getCategoryTitle());
        ((DateAxis) categoryAxis).setDateFormatOverride(new SimpleDateFormat(chartConfig.getDateFormat()));
        if (chartConfig.getCategoryLabelAngle() == 90) {
            ((DateAxis) categoryAxis).setVerticalTickLabels(true);
        } else {
            if (chartConfig.getCategoryLabelAngle() != 0)
                throw new OXFException(
                        "The only supported values of category-label-angle for time-series charts are 0 or 90");
        }
    } else {
        categoryAxis = new CategoryAxis(chartConfig.getCategoryTitle());
        ((CategoryAxis) categoryAxis).setCategoryLabelPositions(chartConfig.getCategoryLabelPosition());
    }
    NumberAxis valueAxis = new RestrictedNumberAxis(chartConfig.getSerieTitle());
    valueAxis.setAutoRangeIncludesZero(chartConfig.getSerieAutoRangeIncludeZero());
    AbstractRenderer renderer = null;
    Plot plot = null;

    switch (chartConfig.getType()) {
    case ChartConfig.VERTICAL_BAR_TYPE:
    case ChartConfig.HORIZONTAL_BAR_TYPE:
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new BarRenderer() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new BarRenderer();

        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);

        if (chartConfig.getType() == ChartConfig.VERTICAL_BAR_TYPE)
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        else
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);

        break;
    case ChartConfig.STACKED_VERTICAL_BAR_TYPE:
    case ChartConfig.STACKED_HORIZONTAL_BAR_TYPE:
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new StackedBarRenderer() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new StackedBarRenderer();
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);

        if (chartConfig.getType() == ChartConfig.STACKED_VERTICAL_BAR_TYPE)
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        else
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);
        break;
    case ChartConfig.LINE_TYPE:
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new LineAndShapeRenderer(true, false) {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : (new LineAndShapeRenderer(true, false));
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);
        ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        break;
    case ChartConfig.AREA_TYPE:
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new AreaRenderer() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new AreaRenderer();
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);
        ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        break;
    case ChartConfig.VERTICAL_BAR3D_TYPE:
    case ChartConfig.HORIZONTAL_BAR3D_TYPE:
        categoryAxis = new CategoryAxis3D(chartConfig.getCategoryTitle());
        valueAxis = new NumberAxis3D(chartConfig.getSerieTitle());
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new BarRenderer3D() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new BarRenderer3D();
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);

        if (chartConfig.getType() == ChartConfig.VERTICAL_BAR3D_TYPE)
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        else
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);

        break;
    case ChartConfig.STACKED_VERTICAL_BAR3D_TYPE:
    case ChartConfig.STACKED_HORIZONTAL_BAR3D_TYPE:
        categoryAxis = new CategoryAxis3D(chartConfig.getCategoryTitle());
        valueAxis = new NumberAxis3D(chartConfig.getSerieTitle());
        renderer = (ds instanceof ItemPaintCategoryDataset) ? new StackedBarRenderer3D() {
            public Paint getItemPaint(int row, int column) {
                Paint p = ((ItemPaintCategoryDataset) ds).getItemPaint(row, column);
                if (p != null)
                    return p;
                else
                    return getSeriesPaint(row);
            }
        } : new StackedBarRenderer3D();
        plot = new CategoryPlot((CategoryDataset) ds, (CategoryAxis) categoryAxis, (ValueAxis) valueAxis,
                (CategoryItemRenderer) renderer);

        if (chartConfig.getType() == ChartConfig.STACKED_VERTICAL_BAR3D_TYPE)
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        else
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);

        break;
    case ChartConfig.PIE_TYPE:
    case ChartConfig.PIE3D_TYPE:
        categoryAxis = null;
        valueAxis = null;
        renderer = null;
        ExtendedPieDataset pds = (ExtendedPieDataset) ds;

        plot = chartConfig.getType() == ChartConfig.PIE_TYPE ? new PiePlot(pds) : new PiePlot3D(pds);

        PiePlot pp = (PiePlot) plot;
        pp.setLabelGenerator(new StandardPieSectionLabelGenerator());

        for (int i = 0; i < pds.getItemCount(); i++) {
            Paint p = pds.getPaint(i);
            if (p != null)
                pp.setSectionPaint(i, p);

            pp.setExplodePercent(i, pds.getExplodePercent(i));

            Paint paint = pds.getPaint(i);
            if (paint != null)
                pp.setSectionPaint(i, paint);
        }
        break;
    case ChartConfig.XY_LINE_TYPE:
        renderer = new XYLineAndShapeRenderer(true, false);
        plot = new XYPlot((XYDataset) ds, (ValueAxis) categoryAxis, (ValueAxis) valueAxis,
                (XYLineAndShapeRenderer) renderer);
        break;
    case ChartConfig.TIME_SERIES_TYPE:
        renderer = new XYLineAndShapeRenderer(true, false);
        plot = new XYPlot((XYDataset) ds, (DateAxis) categoryAxis, (ValueAxis) valueAxis,
                (XYLineAndShapeRenderer) renderer);
        break;
    default:
        throw new OXFException("Chart Type not supported");
    }

    if (categoryAxis != null) {
        categoryAxis.setLabelPaint(chartConfig.getTitleColor());
        categoryAxis.setTickLabelPaint(chartConfig.getTitleColor());
        categoryAxis.setTickMarkPaint(chartConfig.getTitleColor());
        if (categoryAxis instanceof RestrictedNumberAxis) {
            ((RestrictedNumberAxis) categoryAxis).setMaxTicks(chartConfig.getMaxNumOfLabels());
        }
        if (categoryAxis instanceof CategoryAxis && chartConfig.getCategoryMargin() != 0)
            ((CategoryAxis) categoryAxis).setCategoryMargin(chartConfig.getCategoryMargin());
    }

    if (valueAxis != null) {
        valueAxis.setLabelPaint(chartConfig.getTitleColor());
        valueAxis.setTickLabelPaint(chartConfig.getTitleColor());
        valueAxis.setTickMarkPaint(chartConfig.getTitleColor());
        ((RestrictedNumberAxis) valueAxis).setMaxTicks(chartConfig.getMaxNumOfLabels());
    }

    if (renderer != null) {
        if (renderer instanceof XYLineAndShapeRenderer) {
            ((XYLineAndShapeRenderer) renderer).setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
        } else {
            ((CategoryItemRenderer) renderer)
                    .setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        }
        if (renderer instanceof BarRenderer)
            ((BarRenderer) renderer).setItemMargin(chartConfig.getBarMargin());

        int j = 0;
        for (Iterator i = chartConfig.getValueIterator(); i.hasNext();) {
            Value v = (Value) i.next();
            renderer.setSeriesPaint(j, v.getColor());
            j++;
        }
    }

    plot.setOutlinePaint(chartConfig.getTitleColor());
    CustomLegend legend = chartConfig.getLegendConfig();
    chart = new JFreeChart(chartConfig.getTitle(), TextTitle.DEFAULT_FONT, plot, false);
    if (legend.isVisible()) {
        legend.setSources(new LegendItemSource[] { plot });
        chart.addLegend(legend);
    }
    chart.setBackgroundPaint(chartConfig.getBackgroundColor());
    TextTitle textTitle = new TextTitle(chartConfig.getTitle(), TextTitle.DEFAULT_FONT,
            chartConfig.getTitleColor(), TextTitle.DEFAULT_POSITION, TextTitle.DEFAULT_HORIZONTAL_ALIGNMENT,
            TextTitle.DEFAULT_VERTICAL_ALIGNMENT, TextTitle.DEFAULT_PADDING);
    chart.setTitle(textTitle);
    return chart;
}

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

private static JFreeChart createMultiplePieChart3D(CategoryDataset dataset) {

    MultiplePiePlot plot = new MultiplePiePlot(dataset);
    plot.setDataExtractOrder(TableOrder.BY_COLUMN);
    plot.setBackgroundPaint(null);//from   www  .  j  av a 2s . co m
    plot.setOutlineStroke(null);

    JFreeChart pieChart = new JFreeChart(new PiePlot3D(null));
    TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12));
    seriesTitle.setPosition(RectangleEdge.BOTTOM);
    pieChart.setTitle(seriesTitle);
    pieChart.removeLegend();
    pieChart.setBackgroundPaint(null);
    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("MultiplePie Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot,
            legend);
    chart.setBackgroundPaint(Color.white);

    PiePlot piePlot = (PiePlot) pieChart.getPlot();

    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0));
    piePlot.setSectionPaint("First", gp0);
    piePlot.setSectionPaint("Second", gp1);
    piePlot.setSectionPaint("Third", gp2);

    return chart;

}