Java Code Examples for org.jfree.chart.util.RectangleEdge#isTopOrBottom()

The following examples show how to use org.jfree.chart.util.RectangleEdge#isTopOrBottom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModuloAxis.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A regular translation from a data value to a Java2D value.
 *
 * @param value  the value.
 * @param area  the data area.
 * @param edge  the edge along which the axis lies.
 *
 * @return The Java2D coordinate.
 */
private double trans(double value, Rectangle2D area, RectangleEdge edge) {
    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getX() + area.getWidth();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = area.getMaxY();
        max = area.getMaxY() - area.getHeight();
    }
    if (isInverted()) {
        return max - ((value - this.displayStart)
               / (this.displayEnd - this.displayStart)) * (max - min);
    }
    else {
        return min + ((value - this.displayStart)
               / (this.displayEnd - this.displayStart)) * (max - min);
    }

}
 
Example 2
Source File: SymbolAxis.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the grid bands.  Alternate bands are colored using
 * <CODE>gridBandPaint<CODE> (<CODE>DEFAULT_GRID_BAND_PAINT</CODE> by
 * default).
 *
 * @param g2  the graphics device.
 * @param plotArea  the area within which the chart should be drawn.
 * @param dataArea  the area within which the plot should be drawn (a
 *                  subset of the drawArea).
 * @param edge  the axis location.
 * @param ticks  the ticks.
 */
protected void drawGridBands(Graphics2D g2,
                             Rectangle2D plotArea,
                             Rectangle2D dataArea,
                             RectangleEdge edge,
                             List ticks) {

    Shape savedClip = g2.getClip();
    g2.clip(dataArea);
    if (RectangleEdge.isTopOrBottom(edge)) {
        drawGridBandsHorizontal(g2, plotArea, dataArea, true, ticks);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        drawGridBandsVertical(g2, plotArea, dataArea, true, ticks);
    }
    g2.setClip(savedClip);

}
 
Example 3
Source File: LogAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Selects an appropriate tick value for the axis.  The strategy is to
 * display as many ticks as possible (selected from an array of 'standard'
 * tick units) without the labels overlapping.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area defined by the axes.
 * @param edge  the axis location.
 *
 * @since 1.0.7
 */
protected void selectAutoTickUnit(Graphics2D g2, Rectangle2D dataArea,
        RectangleEdge edge) {

    if (RectangleEdge.isTopOrBottom(edge)) {
        selectHorizontalAutoTickUnit(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        selectVerticalAutoTickUnit(g2, dataArea, edge);
    }

}
 
Example 4
Source File: LogarithmicAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts a data value to a coordinate in Java2D space, assuming that
 * the axis runs along one edge of the specified plotArea.
 * Note that it is possible for the coordinate to fall outside the
 * plotArea.
 *
 * @param value  the data value.
 * @param plotArea  the area for plotting the data.
 * @param edge  the axis location.
 *
 * @return The Java2D coordinate.
 */
public double valueToJava2D(double value, Rectangle2D plotArea,
                            RectangleEdge edge) {

    Range range = getRange();
    double axisMin = switchedLog10(range.getLowerBound());
    double axisMax = switchedLog10(range.getUpperBound());

    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = plotArea.getMinX();
        max = plotArea.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = plotArea.getMaxY();
        max = plotArea.getMinY();
    }

    value = switchedLog10(value);

    if (isInverted()) {
        return max - (((value - axisMin) / (axisMax - axisMin))
                * (max - min));
    }
    else {
        return min + (((value - axisMin) / (axisMax - axisMin))
                * (max - min));
    }

}
 
Example 5
Source File: PeriodAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts a coordinate in Java2D space to the corresponding data value,
 * assuming that the axis runs along one edge of the specified dataArea.
 *
 * @param java2DValue  the coordinate in Java2D space.
 * @param area  the area in which the data is plotted.
 * @param edge  the edge along which the axis lies.
 *
 * @return The data value.
 */
public double java2DToValue(double java2DValue, Rectangle2D area,
                            RectangleEdge edge) {

    double result = Double.NaN;
    double min = 0.0;
    double max = 0.0;
    double axisMin = this.first.getFirstMillisecond();
    double axisMax = this.last.getLastMillisecond();
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = area.getMaxY();
        max = area.getY();
    }
    if (isInverted()) {
         result = axisMax - ((java2DValue - min) / (max - min)
                  * (axisMax - axisMin));
    }
    else {
         result = axisMin + ((java2DValue - min) / (max - min)
                  * (axisMax - axisMin));
    }
    return result;
}
 
Example 6
Source File: LogarithmicAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts a data value to a coordinate in Java2D space, assuming that
 * the axis runs along one edge of the specified plotArea.
 * Note that it is possible for the coordinate to fall outside the
 * plotArea.
 *
 * @param value  the data value.
 * @param plotArea  the area for plotting the data.
 * @param edge  the axis location.
 *
 * @return The Java2D coordinate.
 */
public double valueToJava2D(double value, Rectangle2D plotArea,
                            RectangleEdge edge) {

    Range range = getRange();
    double axisMin = switchedLog10(range.getLowerBound());
    double axisMax = switchedLog10(range.getUpperBound());

    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = plotArea.getMinX();
        max = plotArea.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        min = plotArea.getMaxY();
        max = plotArea.getMinY();
    }

    value = switchedLog10(value);

    if (isInverted()) {
        return max - (((value - axisMin) / (axisMax - axisMin)) 
                * (max - min));
    }
    else {
        return min + (((value - axisMin) / (axisMax - axisMin)) 
                * (max - min));
    }

}
 
Example 7
Source File: PeriodAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draws the tick marks for the axis.
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the data area.
 * @param edge  the edge.
 */
protected void drawTickMarks(Graphics2D g2, AxisState state,
                             Rectangle2D dataArea,
                             RectangleEdge edge) {
    if (RectangleEdge.isTopOrBottom(edge)) {
        drawTickMarksHorizontal(g2, state, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        drawTickMarksVertical(g2, state, dataArea, edge);
    }
}
 
Example 8
Source File: LogAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Calculates the positions of the tick labels for the axis, storing the 
 * results in the tick label list (ready for drawing).
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 * 
 * @return A list of ticks.
 *
 */
public List refreshTicks(Graphics2D g2, AxisState state, 
        Rectangle2D dataArea, RectangleEdge edge) {

    List result = new java.util.ArrayList();
    if (RectangleEdge.isTopOrBottom(edge)) {
        result = refreshTicksHorizontal(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        result = refreshTicksVertical(g2, dataArea, edge);
    }
    return result;

}
 
Example 9
Source File: SymbolAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Calculates the positions of the tick labels for the axis, storing the
 * results in the tick label list (ready for drawing).
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the area in which the data should be drawn.
 * @param edge  the location of the axis.
 *
 * @return A list of ticks.
 */
public List refreshTicks(Graphics2D g2,
                         AxisState state,
                         Rectangle2D dataArea,
                         RectangleEdge edge) {
    List ticks = null;
    if (RectangleEdge.isTopOrBottom(edge)) {
        ticks = refreshTicksHorizontal(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        ticks = refreshTicksVertical(g2, dataArea, edge);
    }
    return ticks;
}
 
Example 10
Source File: LogarithmicAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts a coordinate in Java2D space to the corresponding data
 * value, assuming that the axis runs along one edge of the specified
 * plotArea.
 *
 * @param java2DValue  the coordinate in Java2D space.
 * @param plotArea  the area in which the data is plotted.
 * @param edge  the axis location.
 *
 * @return The data value.
 */
public double java2DToValue(double java2DValue, Rectangle2D plotArea,
                            RectangleEdge edge) {

    Range range = getRange();
    double axisMin = switchedLog10(range.getLowerBound());
    double axisMax = switchedLog10(range.getUpperBound());

    double plotMin = 0.0;
    double plotMax = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        plotMin = plotArea.getX();
        plotMax = plotArea.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        plotMin = plotArea.getMaxY();
        plotMax = plotArea.getMinY();
    }

    if (isInverted()) {
        return switchedPow10(axisMax - ((java2DValue - plotMin)
                / (plotMax - plotMin)) * (axisMax - axisMin));
    }
    else {
        return switchedPow10(axisMin + ((java2DValue - plotMin)
                / (plotMax - plotMin)) * (axisMax - axisMin));
    }
}
 
Example 11
Source File: LogarithmicAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts a coordinate in Java2D space to the corresponding data
 * value, assuming that the axis runs along one edge of the specified
 * plotArea.
 *
 * @param java2DValue  the coordinate in Java2D space.
 * @param plotArea  the area in which the data is plotted.
 * @param edge  the axis location.
 *
 * @return The data value.
 */
public double java2DToValue(double java2DValue, Rectangle2D plotArea,
                            RectangleEdge edge) {

    Range range = getRange();
    double axisMin = switchedLog10(range.getLowerBound());
    double axisMax = switchedLog10(range.getUpperBound());

    double plotMin = 0.0;
    double plotMax = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        plotMin = plotArea.getX();
        plotMax = plotArea.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        plotMin = plotArea.getMaxY();
        plotMax = plotArea.getMinY();
    }

    if (isInverted()) {
        return switchedPow10(axisMax - ((java2DValue - plotMin) 
                / (plotMax - plotMin)) * (axisMax - axisMin));
    }
    else {
        return switchedPow10(axisMin + ((java2DValue - plotMin) 
                / (plotMax - plotMin)) * (axisMax - axisMin));
    }
}
 
Example 12
Source File: NumberAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Selects an appropriate tick value for the axis.  The strategy is to
 * display as many ticks as possible (selected from an array of 'standard'
 * tick units) without the labels overlapping.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area defined by the axes.
 * @param edge  the axis location.
 */
protected void selectAutoTickUnit(Graphics2D g2,
                                  Rectangle2D dataArea,
                                  RectangleEdge edge) {

    if (RectangleEdge.isTopOrBottom(edge)) {
        selectHorizontalAutoTickUnit(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        selectVerticalAutoTickUnit(g2, dataArea, edge);
    }

}
 
Example 13
Source File: ModuloAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Translates a data value to a Java2D value for the second section of the 
 * axis.
 * 
 * @param value  the value.
 * @param area  the data area.
 * @param edge  the edge along which the axis lies.
 * @param length1  the length of the first section.
 * @param length2  the length of the second section.
 * 
 * @return The Java2D coordinate.
 */
private double transEnd(double value, Rectangle2D area, RectangleEdge edge,
                        double length1, double length2) {
    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        max = area.getMaxX();
        min = area.getMaxX() - area.getWidth() * length2 
              / (length1 + length2);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        max = area.getMinY();
        min = area.getMinY() + area.getHeight() * length2 
              / (length1 + length2);
    }
    if (isInverted()) {
        return max - ((value - this.fixedRange.getLowerBound()) 
                / (this.displayEnd - this.fixedRange.getLowerBound())) 
                * (max - min);
    }
    else {
        return min + ((value - this.fixedRange.getLowerBound()) 
                / (this.displayEnd - this.fixedRange.getLowerBound())) 
                * (max - min);
    }

}
 
Example 14
Source File: NumberAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Converts a data value to a coordinate in Java2D space, assuming that the
 * axis runs along one edge of the specified dataArea.
 * <p>
 * Note that it is possible for the coordinate to fall outside the plotArea.
 *
 * @param value  the data value.
 * @param area  the area for plotting the data.
 * @param edge  the axis location.
 *
 * @return The Java2D coordinate.
 *
 * @see #java2DToValue(double, Rectangle2D, RectangleEdge)
 */
public double valueToJava2D(double value, Rectangle2D area,
                            RectangleEdge edge) {

    Range range = getRange();
    double axisMin = range.getLowerBound();
    double axisMax = range.getUpperBound();

    double min = 0.0;
    double max = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        min = area.getX();
        max = area.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        max = area.getMinY();
        min = area.getMaxY();
    }
    if (isInverted()) {
        return max
               - ((value - axisMin) / (axisMax - axisMin)) * (max - min);
    }
    else {
        return min
               + ((value - axisMin) / (axisMax - axisMin)) * (max - min);
    }

}
 
Example 15
Source File: LogAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Calculates the positions of the tick labels for the axis, storing the
 * results in the tick label list (ready for drawing).
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 *
 * @return A list of ticks.
 *
 */
public List refreshTicks(Graphics2D g2, AxisState state,
        Rectangle2D dataArea, RectangleEdge edge) {

    List result = new java.util.ArrayList();
    if (RectangleEdge.isTopOrBottom(edge)) {
        result = refreshTicksHorizontal(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        result = refreshTicksVertical(g2, dataArea, edge);
    }
    return result;

}
 
Example 16
Source File: DateAxis.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Selects an appropriate tick value for the axis.  The strategy is to
 * display as many ticks as possible (selected from an array of 'standard'
 * tick units) without the labels overlapping.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area defined by the axes.
 * @param edge  the axis location.
 */
protected void selectAutoTickUnit(Graphics2D g2,
                                  Rectangle2D dataArea,
                                  RectangleEdge edge) {

    if (RectangleEdge.isTopOrBottom(edge)) {
        selectHorizontalAutoTickUnit(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        selectVerticalAutoTickUnit(g2, dataArea, edge);
    }

}
 
Example 17
Source File: CyclicNumberAxis.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Translates a value from data space to Java 2D space.
 *
 * @param value  the data value.
 * @param dataArea  the data area.
 * @param edge  the edge.
 *
 * @return The Java 2D value.
 */
public double valueToJava2D(double value, Rectangle2D dataArea,
                            RectangleEdge edge) {
    Range range = getRange();

    double vmin = range.getLowerBound();
    double vmax = range.getUpperBound();
    double vp = getCycleBound();

    if ((value < vmin) || (value > vmax)) {
        return Double.NaN;
    }


    double jmin = 0.0;
    double jmax = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        jmin = dataArea.getMinX();
        jmax = dataArea.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        jmax = dataArea.getMinY();
        jmin = dataArea.getMaxY();
    }

    if (isInverted()) {
        if (value == vp) {
            return this.boundMappedToLastCycle ? jmin : jmax;
        }
        else if (value > vp) {
            return jmax - (value - vp) * (jmax - jmin) / this.period;
        }
        else {
            return jmin + (vp - value) * (jmax - jmin) / this.period;
        }
    }
    else {
        if (value == vp) {
            return this.boundMappedToLastCycle ? jmax : jmin;
        }
        else if (value >= vp) {
            return jmin + (value - vp) * (jmax - jmin) / this.period;
        }
        else {
            return jmax - (vp - value) * (jmax - jmin) / this.period;
        }
    }
}
 
Example 18
Source File: CategoryAxis.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Estimates the space required for the axis, given a specific drawing area.
 *
 * @param g2  the graphics device (used to obtain font information).
 * @param plot  the plot that the axis belongs to.
 * @param plotArea  the area within which the axis should be drawn.
 * @param edge  the axis location (top or bottom).
 * @param space  the space already reserved.
 *
 * @return The space required to draw the axis.
 */
public AxisSpace reserveSpace(Graphics2D g2, Plot plot,
                              Rectangle2D plotArea,
                              RectangleEdge edge, AxisSpace space) {

    // create a new space object if one wasn't supplied...
    if (space == null) {
        space = new AxisSpace();
    }

    // if the axis is not visible, no additional space is required...
    if (!isVisible()) {
        return space;
    }

    // calculate the max size of the tick labels (if visible)...
    double tickLabelHeight = 0.0;
    double tickLabelWidth = 0.0;
    if (isTickLabelsVisible()) {
        g2.setFont(getTickLabelFont());
        AxisState state = new AxisState();
        // we call refresh ticks just to get the maximum width or height
        refreshTicks(g2, state, plotArea, edge);
        if (edge == RectangleEdge.TOP) {
            tickLabelHeight = state.getMax();
        }
        else if (edge == RectangleEdge.BOTTOM) {
            tickLabelHeight = state.getMax();
        }
        else if (edge == RectangleEdge.LEFT) {
            tickLabelWidth = state.getMax();
        }
        else if (edge == RectangleEdge.RIGHT) {
            tickLabelWidth = state.getMax();
        }
    }

    // get the axis label size and update the space object...
    Rectangle2D labelEnclosure = getLabelEnclosure(g2, edge);
    double labelHeight = 0.0;
    double labelWidth = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        labelHeight = labelEnclosure.getHeight();
        space.add(labelHeight + tickLabelHeight
                + this.categoryLabelPositionOffset, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        labelWidth = labelEnclosure.getWidth();
        space.add(labelWidth + tickLabelWidth
                + this.categoryLabelPositionOffset, edge);
    }
    return space;

}
 
Example 19
Source File: ValueAxis.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the space required to draw the axis.
 *
 * @param g2  the graphics device.
 * @param plot  the plot that the axis belongs to.
 * @param plotArea  the area within which the plot should be drawn.
 * @param edge  the axis location.
 * @param space  the space already reserved (for other axes).
 *
 * @return The space required to draw the axis (including pre-reserved
 *         space).
 */
public AxisSpace reserveSpace(Graphics2D g2, Plot plot,
                              Rectangle2D plotArea,
                              RectangleEdge edge, AxisSpace space) {

    // create a new space object if one wasn't supplied...
    if (space == null) {
        space = new AxisSpace();
    }

    // if the axis is not visible, no additional space is required...
    if (!isVisible()) {
        return space;
    }

    // if the axis has a fixed dimension, return it...
    double dimension = getFixedDimension();
    if (dimension > 0.0) {
        space.ensureAtLeast(dimension, edge);
    }

    // calculate the max size of the tick labels (if visible)...
    double tickLabelHeight = 0.0;
    double tickLabelWidth = 0.0;
    if (isTickLabelsVisible()) {
        g2.setFont(getTickLabelFont());
        List ticks = refreshTicks(g2, new AxisState(), plotArea, edge);
        if (RectangleEdge.isTopOrBottom(edge)) {
            tickLabelHeight = findMaximumTickLabelHeight(ticks, g2,
                    plotArea, isVerticalTickLabels());
        }
        else if (RectangleEdge.isLeftOrRight(edge)) {
            tickLabelWidth = findMaximumTickLabelWidth(ticks, g2, plotArea,
                    isVerticalTickLabels());
        }
    }

    // get the axis label size and update the space object...
    Rectangle2D labelEnclosure = getLabelEnclosure(g2, edge);
    double labelHeight = 0.0;
    double labelWidth = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        labelHeight = labelEnclosure.getHeight();
        space.add(labelHeight + tickLabelHeight, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        labelWidth = labelEnclosure.getWidth();
        space.add(labelWidth + tickLabelWidth, edge);
    }

    return space;

}
 
Example 20
Source File: CyclicNumberAxis.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Translates a value from data space to Java 2D space.
 * 
 * @param value  the data value.
 * @param dataArea  the data area.
 * @param edge  the edge.
 * 
 * @return The Java 2D value.
 */
public double valueToJava2D(double value, Rectangle2D dataArea, 
                            RectangleEdge edge) {
    Range range = getRange();
    
    double vmin = range.getLowerBound();
    double vmax = range.getUpperBound();
    double vp = getCycleBound();

    if ((value < vmin) || (value > vmax)) {
        return Double.NaN;
    }
    
    
    double jmin = 0.0;
    double jmax = 0.0;
    if (RectangleEdge.isTopOrBottom(edge)) {
        jmin = dataArea.getMinX();
        jmax = dataArea.getMaxX();
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        jmax = dataArea.getMinY();
        jmin = dataArea.getMaxY();
    }

    if (isInverted()) {
        if (value == vp) {
            return this.boundMappedToLastCycle ? jmin : jmax; 
        }
        else if (value > vp) {
            return jmax - (value - vp) * (jmax - jmin) / this.period;
        } 
        else {
            return jmin + (vp - value) * (jmax - jmin) / this.period;
        }
    }
    else {
        if (value == vp) {
            return this.boundMappedToLastCycle ? jmax : jmin; 
        }
        else if (value >= vp) {
            return jmin + (value - vp) * (jmax - jmin) / this.period;
        } 
        else {
            return jmax - (vp - value) * (jmax - jmin) / this.period;
        }
    }
}