Example usage for org.jfree.eastwood GCategoryAxis3D GCategoryAxis3D

List of usage examples for org.jfree.eastwood GCategoryAxis3D GCategoryAxis3D

Introduction

In this page you can find the example usage for org.jfree.eastwood GCategoryAxis3D GCategoryAxis3D.

Prototype

public GCategoryAxis3D() 

Source Link

Document

Creates a new instance.

Usage

From source file:org.jfree.eastwood.ChartEngine.java

/**
 * Creates a bar chart with the specified orientation and using the
 * specified renderer.//from   ww  w.j  av  a2 s  .  co m
 *
 * @param orientation  the plot orientation.
 * @param renderer     the renderer.
 *
 * @return A bar chart.
 */
private static JFreeChart createBarChart3D(PlotOrientation orientation, BarRenderer renderer) {
    GCategoryPlot plot = new GCategoryPlot();
    plot.setOrientation(orientation);
    if (orientation.equals(PlotOrientation.HORIZONTAL)) {
        plot.setColumnRenderingOrder(SortOrder.DESCENDING);
    }
    JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false);

    chart.setBackgroundPaint(Color.white);
    plot.setBackgroundPaint(null);
    plot.setRenderer(renderer);
    renderer.setBasePaint(new Color(0xFFCC33));
    renderer.setAutoPopulateSeriesPaint(false);
    renderer.setBasePaint(new Color(0xFFCC33));
    renderer.setAutoPopulateSeriesPaint(false);
    renderer.setItemLabelsVisible(true);
    renderer.setItemLabelGenerator(new GCategoryPlot.LabelGenerator());
    renderer.setItemLabelPaint(new Color(0x333435));

    if (orientation == PlotOrientation.HORIZONTAL) {
        renderer.setPositiveItemLabelPosition(
                new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT));
        renderer.setPositiveItemLabelPositionFallback(
                new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_RIGHT));
    } else {
        renderer.setPositiveItemLabelPosition(
                new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
        renderer.setPositiveItemLabelPositionFallback(
                new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER));
    }

    GCategoryAxis3D xAxis = new GCategoryAxis3D();
    xAxis.setAxisLineVisible(true);
    xAxis.setTickLabelsVisible(false);
    xAxis.setMaximumCategoryLabelLines(5);
    plot.setDomainAxis(xAxis);
    GValueAxis3D yAxis = new GValueAxis3D();
    yAxis.setAxisLineVisible(true);
    yAxis.setTickLabelsVisible(false);
    yAxis.setTickMarksVisible(false);
    plot.setRangeAxis(yAxis);
    plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    plot.setDomainGridlinesVisible(false);
    plot.setRangeGridlinesVisible(false);
    return chart;
}