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

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

Introduction

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

Prototype

public double getLowerBound() 

Source Link

Document

Returns the lower bound of the axis range.

Usage

From source file:net.sf.mzmine.chartbasics.ChartLogics.java

/**
 * Apply an absolute offset to an axis and move it
 * //from   w w w .jav a  2 s . c  om
 * @param myChart
 * @param offset
 */
public static void offsetAxisAbsolute(ValueAxis axis, double offset) {
    Range range = new Range(axis.getLowerBound() + offset, axis.getUpperBound() + offset);
    setZoomAxis(axis, keepRangeWithinAutoBounds(axis, range));
}

From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java

/**
 * /*from  ww w  .  ja  va 2s .c o m*/
 * @param myChart
 * @return Range the domainAxis zoom (X-axis)
 */
public static Range getZoomDomainAxis(ChartViewer myChart) {
    XYPlot plot = (XYPlot) myChart.getChart().getPlot();
    ValueAxis domainAxis = plot.getDomainAxis();

    return new Range(domainAxis.getLowerBound(), domainAxis.getUpperBound());
}

From source file:net.sf.mzmine.chartbasics.ChartLogics.java

/**
 * /*from ww w .  j  a  v  a  2  s .c  o  m*/
 * @param myChart
 * @return Range the domainAxis zoom (X-axis)
 */
public static Range getZoomDomainAxis(ChartPanel myChart) {
    XYPlot plot = (XYPlot) myChart.getChart().getPlot();
    ValueAxis domainAxis = plot.getDomainAxis();

    return new Range(domainAxis.getLowerBound(), domainAxis.getUpperBound());
}

From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java

/**
 * Zoom in (negative yzoom) or zoom out of range axis.
 * /*from www .  j  a  va 2  s  .  c o m*/
 * @param myChart
 * @param yzoom percentage zoom factor
 * @param holdLowerBound if true only the upper bound will be zoomed
 */
public static void zoomRangeAxis(ChartViewer myChart, double yzoom, boolean holdLowerBound) {
    XYPlot plot = (XYPlot) myChart.getChart().getPlot();
    ValueAxis rangeAxis = plot.getRangeAxis();

    double lower = rangeAxis.getLowerBound();
    double upper = rangeAxis.getUpperBound();
    double dist = upper - lower;

    if (holdLowerBound) {
        upper += dist * yzoom;
    } else {
        lower -= dist * yzoom / 2;
        upper += dist * yzoom / 2;
    }

    if (lower < upper) {
        Range range = new Range(lower, upper);
        setZoomAxis(rangeAxis, keepRangeWithinAutoBounds(rangeAxis, range));
    }
}

From source file:net.sf.mzmine.chartbasics.ChartLogics.java

/**
 * Zoom in (negative zoom) or zoom out of axis.
 * /*from  w w w. j  a va  2s .  com*/
 * @param myChart
 * @param zoom percentage zoom factor
 * @param start point on this range (first click/pressed event), used as center
 */
public static void zoomAxis(ValueAxis axis, double zoom, double start) {
    double lower = axis.getLowerBound();
    double upper = axis.getUpperBound();
    double dist = upper - lower;
    double f = (start - lower) / dist;

    lower -= dist * zoom * f;
    upper += dist * zoom * (1 - f);

    if (lower < upper) {
        Range range = new Range(lower, upper);
        setZoomAxis(axis, keepRangeWithinAutoBounds(axis, range));
    }
}

From source file:net.sf.mzmine.chartbasics.ChartLogics.java

/**
 * Apply an relative offset to an axis and move it. LowerBound and UpperBound are defined by
 * {@link ValueAxis#getDefaultAutoRange()}
 * /* w  w w  . j av  a  2  s  .  c o  m*/
 * @param myChart
 * @param offset percentage
 */
public static void offsetAxis(ValueAxis axis, double offset) {
    double distance = (axis.getUpperBound() - axis.getLowerBound()) * offset;
    Range range = new Range(axis.getLowerBound() + distance, axis.getUpperBound() + distance);
    setZoomAxis(axis, keepRangeWithinAutoBounds(axis, range));
}

From source file:net.sf.mzmine.chartbasics.ChartLogics.java

/**
 * Zoom in (negative zoom) or zoom out of axis.
 * //  w w  w.  ja  va 2  s  .  c o m
 * @param myChart
 * @param zoom percentage zoom factor
 * @param holdLowerBound if true only the upper bound will be zoomed
 */
public static void zoomAxis(ValueAxis axis, double zoom, boolean holdLowerBound) {
    double lower = axis.getLowerBound();
    double upper = axis.getUpperBound();
    double dist = upper - lower;

    if (holdLowerBound) {
        if (zoom == 0)
            return;
        upper += dist * zoom;
    } else {
        lower -= dist * zoom / 2;
        upper += dist * zoom / 2;
    }

    if (lower < upper) {
        logger.info("Set zoom:" + lower + ", " + upper + " (keep lower:" + holdLowerBound + ")");
        Range range = new Range(lower, upper);
        setZoomAxis(axis, keepRangeWithinAutoBounds(axis, range));
    }
}

From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java

/**
 * Apply an absolute offset to domain (x) axis and move it
 * /*from  w w  w . jav  a2  s  .  c  o m*/
 * @param myChart
 * @param xoffset
 * @param autoRangeY
 */
public static void offsetDomainAxisAbsolute(ChartViewer myChart, double xoffset, boolean autoRangeY) {
    XYPlot plot = (XYPlot) myChart.getChart().getPlot();
    ValueAxis domainAxis = plot.getDomainAxis();
    // apply offset on x

    Range range = new Range(domainAxis.getLowerBound() + xoffset, domainAxis.getUpperBound() + xoffset);
    setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY);
}

From source file:net.sf.mzmine.chartbasics.ChartLogics.java

/**
 * Apply an absolute offset to domain (x) axis and move it
 * //  ww  w  .  ja v a  2s. c om
 * @param myChart
 * @param xoffset
 * @param autoRangeY
 */
public static void offsetDomainAxisAbsolute(ChartPanel myChart, double xoffset, boolean autoRangeY) {
    XYPlot plot = (XYPlot) myChart.getChart().getPlot();
    ValueAxis domainAxis = plot.getDomainAxis();
    // apply offset on x

    Range range = new Range(domainAxis.getLowerBound() + xoffset, domainAxis.getUpperBound() + xoffset);
    setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY);
}

From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java

/**
 * Move a chart by a percentage x-offset if xoffset is <0 the shift will be negativ (xoffset>0
 * results in a positive shift)//from w w w . j a  v  a 2s .c om
 * 
 * @param myChart
 * @param xoffset in percent
 * @param autoRangeY if true the range (Y) axis auto bounds will be restored
 */
public static void offsetDomainAxis(ChartViewer myChart, double xoffset, boolean autoRangeY) {
    XYPlot plot = (XYPlot) myChart.getChart().getPlot();
    ValueAxis domainAxis = plot.getDomainAxis();
    // apply offset on x
    double distance = (domainAxis.getUpperBound() - domainAxis.getLowerBound()) * xoffset;

    Range range = new Range(domainAxis.getLowerBound() + distance, domainAxis.getUpperBound() + distance);
    setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY);
}