Example usage for org.jfree.chart.axis AxisLocation getOpposite

List of usage examples for org.jfree.chart.axis AxisLocation getOpposite

Introduction

In this page you can find the example usage for org.jfree.chart.axis AxisLocation getOpposite.

Prototype

public static AxisLocation getOpposite(AxisLocation location) 

Source Link

Document

Returns the location that is opposite to the supplied location.

Usage

From source file:org.nbheaven.sqe.codedefects.dashboard.controlcenter.panels.Statistics.java

private static JFreeChart createOverviewPanel(DefaultCategoryDataset dataSet) {

    JFreeChart overview = org.jfree.chart.ChartFactory.createStackedBarChart(null, null, "CodeDefects", dataSet,
            PlotOrientation.HORIZONTAL, false, true, false);
    overview.setBorderVisible(false);/*ww  w. j  a va  2 s  .co  m*/
    overview.setBackgroundPaint(Color.WHITE);
    overview.setAntiAlias(true);
    overview.setNotify(true);

    CategoryPlot overviewPlot = overview.getCategoryPlot();
    overviewPlot.setRangeGridlinePaint(Color.BLACK);
    overviewPlot.setDomainGridlinePaint(Color.BLACK);
    overviewPlot.setBackgroundPaint(Color.WHITE);
    overviewPlot.setForegroundAlpha(0.7f);
    overviewPlot.setRangeAxisLocation(AxisLocation.getOpposite(overviewPlot.getRangeAxisLocation()));

    CategoryAxis domainAxis = overviewPlot.getDomainAxis();
    domainAxis.setVisible(true);

    LogarithmicAxis rangeAxis = new LogarithmicAxis("CodeDefects");
    rangeAxis.setLabel(null);
    rangeAxis.setStrictValuesFlag(false);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    overviewPlot.setRangeAxis(rangeAxis);

    CategoryItemRenderer categoryItemRenderer = new StackedBarRenderer(); //3D();
    //        categoryItemRenderers[0].setPaint(Color.RED);
    categoryItemRenderer.setSeriesPaint(0, Color.RED);
    categoryItemRenderer.setSeriesPaint(1, Color.ORANGE);
    categoryItemRenderer.setSeriesPaint(2, Color.YELLOW);

    categoryItemRenderer.setBaseItemLabelsVisible(true);

    overviewPlot.setRenderer(categoryItemRenderer);

    return overview;
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Returns the location for a domain axis.  If this hasn't been set
 * explicitly, the method returns the location that is opposite to the
 * primary domain axis location.//from   w  ww. j av  a  2  s .  c om
 *
 * @param index  the axis index.
 *
 * @return The location (never <code>null</code>).
 */
public AxisLocation getDomainAxisLocation(int index) {
    AxisLocation result = null;
    if (index < this.domainAxisLocations.size()) {
        result = (AxisLocation) this.domainAxisLocations.get(index);
    }
    if (result == null) {
        result = AxisLocation.getOpposite(getDomainAxisLocation());
    }
    return result;
}

From source file:ucar.unidata.idv.control.chart.MyXYPlot.java

/**
 * Returns the location for a range axis.  If this hasn't been set
 * explicitly, the method returns the location that is opposite to the
 * primary range axis location./*from   ww w. j ava2  s. co  m*/
 *
 * @param index  the axis index.
 *
 * @return The location (never <code>null</code>).
 */
public AxisLocation getRangeAxisLocation(int index) {
    AxisLocation result = null;
    if (index < this.rangeAxisLocations.size()) {
        result = (AxisLocation) this.rangeAxisLocations.get(index);
    }
    if (result == null) {
        result = AxisLocation.getOpposite(getRangeAxisLocation());
    }
    return result;
}