Example usage for org.jfree.eastwood GValueAxis3D GValueAxis3D

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

Introduction

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

Prototype

public GValueAxis3D() 

Source Link

Document

Creates a new axis.

Usage

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

/**
 * Creates a bar chart with the specified orientation and using the
 * specified renderer.//from   w  ww .  ja  v  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;
}