Beispiel #1
0
  /**
   * Creates a vertical 3D-effect bar chart with default settings.
   *
   * @param title the chart title.
   * @param categoryAxisLabel the label for the category axis.
   * @param valueAxisLabel the label for the value axis.
   * @param data the dataset for the chart.
   * @param legend a flag specifying whether or not a legend is required.
   * @param tooltips configure chart to generate tool tips?
   * @param urls configure chart to generate URLs?
   * @return a vertical 3D-effect bar chart.
   */
  public static JFreeChart createBarChart3D(
      String title,
      java.awt.Font titleFont,
      String categoryAxisLabel,
      String valueAxisLabel,
      CategoryDataset data,
      PlotOrientation orientation,
      boolean legend,
      boolean tooltips,
      boolean urls,
      CategoryURLGenerator urlGenerator) {

    CategoryAxis categoryAxis = new CategoryAxis3D(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis3D(valueAxisLabel);

    BarRenderer3D renderer = new BarRenderer3D();

    // renderer.setLabelGenerator(new StandardCategoryLabelGenerator());
    if (tooltips) {
      renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
      renderer.setItemURLGenerator(urlGenerator);
    }

    CategoryPlot plot = new CategoryPlot(data, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    plot.setForegroundAlpha(0.75f);

    JFreeChart chart = new JFreeChart(title, titleFont, plot, legend);

    return chart;
  }