Example #1
0
  /**
   * Creates a sample dataset for the demo.
   *
   * @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;
  }