Example usage for org.jfree.chart.axis ValueAxis isAutoRange

List of usage examples for org.jfree.chart.axis ValueAxis isAutoRange

Introduction

In this page you can find the example usage for org.jfree.chart.axis ValueAxis isAutoRange.

Prototype

public boolean isAutoRange() 

Source Link

Document

Returns the flag that controls whether or not the axis range is automatically adjusted to fit the data values.

Usage

From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java

public static void customizeValueAxis(ValueAxis axis, ChartParams params, String prefix) {
    customizeAxis(axis, params, prefix);

    if (params.get(prefix + ChartParams.VALUE_AXIS_AUTO_RANGE_SUFFIX) != null) {
        axis.setAutoRange(params.getBoolean(prefix + ChartParams.VALUE_AXIS_AUTO_RANGE_SUFFIX).booleanValue());
    }/*from w w w .j  a va 2s . c  om*/
    if (axis.isAutoRange()) { // work only with auto range
        if (params.get(prefix + ChartParams.VALUE_AXIS_AUTO_RANGE_MIN_SIZE_SUFFIX) != null) {
            axis.setAutoRangeMinimumSize(
                    params.getDouble(prefix + ChartParams.VALUE_AXIS_AUTO_RANGE_MIN_SIZE_SUFFIX).doubleValue());
        }
        if (params.get(prefix + ChartParams.AXIS_LOWER_MARGIN_SUFFIX) != null) {
            axis.setLowerMargin(params.getDouble(prefix + ChartParams.AXIS_LOWER_MARGIN_SUFFIX).doubleValue());
        }
        if (params.get(prefix + ChartParams.AXIS_UPPER_MARGIN_SUFFIX) != null) {
            axis.setUpperMargin(params.getDouble(prefix + ChartParams.AXIS_UPPER_MARGIN_SUFFIX).doubleValue());
        }
    } else { // work only when auto range is off
        if (params.get(prefix + ChartParams.VALUE_AXIS_LOWER_BOUND_SUFFIX) != null) {
            axis.setLowerBound(
                    params.getDouble(prefix + ChartParams.VALUE_AXIS_LOWER_BOUND_SUFFIX).doubleValue());
        }
        if (params.get(prefix + ChartParams.VALUE_AXIS_UPPER_BOUND_SUFFIX) != null) {
            axis.setUpperBound(
                    params.getDouble(prefix + ChartParams.VALUE_AXIS_UPPER_BOUND_SUFFIX).doubleValue());
        }
    }
    if (params.get(prefix + ChartParams.VALUE_AXIS_AUTO_TICK_UNIT_SUFFIX) != null) {
        axis.setAutoTickUnitSelection(
                params.getBoolean(prefix + ChartParams.VALUE_AXIS_AUTO_TICK_UNIT_SUFFIX).booleanValue());
    }
    if (params.get(prefix + ChartParams.VALUE_AXIS_VERTICAL_TICK_LABELS_SUFFIX) != null) {
        axis.setVerticalTickLabels(
                params.getBoolean(prefix + ChartParams.VALUE_AXIS_VERTICAL_TICK_LABELS_SUFFIX).booleanValue());
    }
}

From source file:edu.wisc.ssec.mcidasv.control.McIDASVHistogramWrapper.java

/**
 * Modify the low and high values of the domain axis.
 *
 * @param lowVal Low value./*from   www .j  a  v a2 s . c  om*/
 * @param hiVal High value.
 * @param notify Whether or not listeners should be notified.
 *
 * @return {@code false} if {@link #plot} is {@code null}. {@code true}
 * otherwise.
 */
protected boolean modifyRange(double lowVal, double hiVal, boolean notify) {
    try {
        if (plot == null) {
            return false;
        }
        ValueAxis domainAxis = plot.getDomainAxis();
        org.jfree.data.Range newRange = new org.jfree.data.Range(lowVal, hiVal);
        domainAxis.setRange(newRange, domainAxis.isAutoRange(), notify);
        return true;
    } catch (Exception e) {
        return true;
    }
}

From source file:ucar.unidata.idv.control.McVHistogramWrapper.java

/**
 * Modify the low and high values of the domain axis.
 *
 * @param lowVal Low value.//from w  w w.  ja v a 2 s. c om
 * @param hiVal High value.
 * @param notify Whether or not listeners should be notified.
 *
 * @return {@code false} if {@link #plot} is {@code null}. {@code true}
 * otherwise.
 */
public boolean modifyRange(double lowVal, double hiVal, boolean notify) {
    try {
        if (plot == null) {
            return false;
        }
        ValueAxis domainAxis = plot.getDomainAxis();
        org.jfree.data.Range newRange = new org.jfree.data.Range(lowVal, hiVal);
        domainAxis.setRange(newRange, domainAxis.isAutoRange(), notify);
        return true;
    } catch (Exception e) {
        return true;
    }
}