Java Code Examples for org.jfree.chart.axis.ValueAxis#isInverted()

The following examples show how to use org.jfree.chart.axis.ValueAxis#isInverted() . 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: XYPlot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    int rangeAxisCount = getRangeAxisCount();
    for (int i = 0; i < rangeAxisCount; i++) {
        ValueAxis axis = getRangeAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 2
Source File: XYPlot.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Pans the domain axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panDomainAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isDomainPannable()) {
        return;
    }
    int domainAxisCount = getDomainAxisCount();
    for (int i = 0; i < domainAxisCount; i++) {
        ValueAxis axis = getDomainAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 3
Source File: Cardumen_0082_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Pans the domain axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
public void panDomainAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isDomainPannable()) {
        return;
    }
    int domainAxisCount = getDomainAxisCount();
    for (int i = 0; i < domainAxisCount; i++) {
        ValueAxis axis = getDomainAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 4
Source File: XYPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    int rangeAxisCount = getRangeAxisCount();
    for (int i = 0; i < rangeAxisCount; i++) {
        ValueAxis axis = getRangeAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 5
Source File: CategoryPlot.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    int rangeAxisCount = getRangeAxisCount();
    for (int i = 0; i < rangeAxisCount; i++) {
        ValueAxis axis = getRangeAxis(i);
        if (axis == null) {
            continue;
        }
        double length = axis.getRange().getLength();
        double adj = percent * length;
        if (axis.isInverted()) {
            adj = -adj;
        }
        axis.setRange(axis.getLowerBound() + adj,
                axis.getUpperBound() + adj);
    }
}
 
Example 6
Source File: Cardumen_009_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    int rangeAxisCount = getRangeAxisCount();
    for (int i = 0; i < rangeAxisCount; i++) {
        ValueAxis axis = getRangeAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 7
Source File: XYPlot.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    int rangeAxisCount = getRangeAxisCount();
    for (int i = 0; i < rangeAxisCount; i++) {
        ValueAxis axis = getRangeAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 8
Source File: Cardumen_009_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    int rangeAxisCount = getRangeAxisCount();
    for (int i = 0; i < rangeAxisCount; i++) {
        ValueAxis axis = getRangeAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 9
Source File: Cardumen_009_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Pans the domain axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
public void panDomainAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isDomainPannable()) {
        return;
    }
    int domainAxisCount = getDomainAxisCount();
    for (int i = 0; i < domainAxisCount; i++) {
        ValueAxis axis = getDomainAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 10
Source File: CategoryPlot.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    for (ValueAxis axis : this.rangeAxes.values()) {
        if (axis == null) {
            continue;
        }
        double length = axis.getRange().getLength();
        double adj = percent * length;
        if (axis.isInverted()) {
            adj = -adj;
        }
        axis.setRange(axis.getLowerBound() + adj,
                axis.getUpperBound() + adj);
    }
}
 
Example 11
Source File: XYPlot.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Pans the domain axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panDomainAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isDomainPannable()) {
        return;
    }
    int domainAxisCount = getDomainAxisCount();
    for (int i = 0; i < domainAxisCount; i++) {
        ValueAxis axis = getDomainAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 12
Source File: CategoryPlot.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    for (ValueAxis axis : this.rangeAxes.values()) {
        if (axis == null) {
            continue;
        }
        double length = axis.getRange().getLength();
        double adj = percent * length;
        if (axis.isInverted()) {
            adj = -adj;
        }
        axis.setRange(axis.getLowerBound() + adj,
                axis.getUpperBound() + adj);
    }
}
 
Example 13
Source File: CategoryPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    for (ValueAxis axis : this.rangeAxes.values()) {
        if (axis == null) {
            continue;
        }
        double length = axis.getRange().getLength();
        double adj = percent * length;
        if (axis.isInverted()) {
            adj = -adj;
        }
        axis.setRange(axis.getLowerBound() + adj,
                axis.getUpperBound() + adj);
    }
}
 
Example 14
Source File: XYPlot.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Pans the domain axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panDomainAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isDomainPannable()) {
        return;
    }
    int domainAxisCount = getDomainAxisCount();
    for (int i = 0; i < domainAxisCount; i++) {
        ValueAxis axis = getDomainAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 15
Source File: CategoryPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    for (ValueAxis axis : this.rangeAxes.values()) {
        if (axis == null) {
            continue;
        }
        double length = axis.getRange().getLength();
        double adj = percent * length;
        if (axis.isInverted()) {
            adj = -adj;
        }
        axis.setRange(axis.getLowerBound() + adj,
                axis.getUpperBound() + adj);
    }
}
 
Example 16
Source File: XYPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Pans the range axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panRangeAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isRangePannable()) {
        return;
    }
    int rangeAxisCount = getRangeAxisCount();
    for (int i = 0; i < rangeAxisCount; i++) {
        ValueAxis axis = getRangeAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 17
Source File: XYPlot.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Pans the domain axes by the specified percentage.
 *
 * @param percent  the distance to pan (as a percentage of the axis length).
 * @param info the plot info
 * @param source the source point where the pan action started.
 *
 * @since 1.0.13
 */
@Override
public void panDomainAxes(double percent, PlotRenderingInfo info,
        Point2D source) {
    if (!isDomainPannable()) {
        return;
    }
    int domainAxisCount = getDomainAxisCount();
    for (int i = 0; i < domainAxisCount; i++) {
        ValueAxis axis = getDomainAxis(i);
        if (axis == null) {
            continue;
        }
        if (axis.isInverted()) {
            percent = -percent;
        }
        axis.pan(percent);
    }
}
 
Example 18
Source File: DefaultPolarItemRenderer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param radialAxis  the radial axis (<code>null</code> not permitted).
 * @param ticks  the ticks (<code>null</code> not permitted).
 * @param dataArea  the data area.
 */
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 
        ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {

    ParamChecks.nullNotPermitted(radialAxis, "radialAxis");
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double centerValue;
    if (radialAxis.isInverted()) {
        centerValue = radialAxis.getUpperBound();
    } else {
        centerValue = radialAxis.getLowerBound();
    }
    Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        double angleDegrees = plot.isCounterClockwise() 
                ? plot.getAngleOffset() : -plot.getAngleOffset();
        Point p = plot.translateToJava2D(angleDegrees,
                tick.getNumber().doubleValue(), radialAxis, dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example 19
Source File: DefaultPolarItemRenderer.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draw the radial gridlines - the rings.
 *
 * @param g2  the drawing surface (<code>null</code> not permitted).
 * @param plot  the plot (<code>null</code> not permitted).
 * @param radialAxis  the radial axis (<code>null</code> not permitted).
 * @param ticks  the ticks (<code>null</code> not permitted).
 * @param dataArea  the data area.
 */
@Override
public void drawRadialGridLines(Graphics2D g2, PolarPlot plot, 
        ValueAxis radialAxis, List ticks, Rectangle2D dataArea) {

    ParamChecks.nullNotPermitted(radialAxis, "radialAxis");
    g2.setFont(radialAxis.getTickLabelFont());
    g2.setPaint(plot.getRadiusGridlinePaint());
    g2.setStroke(plot.getRadiusGridlineStroke());

    double centerValue;
    if (radialAxis.isInverted()) {
        centerValue = radialAxis.getUpperBound();
    } else {
        centerValue = radialAxis.getLowerBound();
    }
    Point center = plot.translateToJava2D(0, centerValue, radialAxis, dataArea);

    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        NumberTick tick = (NumberTick) iterator.next();
        double angleDegrees = plot.isCounterClockwise() 
                ? plot.getAngleOffset() : -plot.getAngleOffset();
        Point p = plot.translateToJava2D(angleDegrees,
                tick.getNumber().doubleValue(), radialAxis, dataArea);
        int r = p.x - center.x;
        int upperLeftX = center.x - r;
        int upperLeftY = center.y - r;
        int d = 2 * r;
        Ellipse2D ring = new Ellipse2D.Double(upperLeftX, upperLeftY, d, d);
        g2.setPaint(plot.getRadiusGridlinePaint());
        g2.draw(ring);
    }
}
 
Example 20
Source File: BarRenderer.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public Rectangle2D createHotSpotBounds(Graphics2D g2, Rectangle2D dataArea,
        CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis,
        CategoryDataset dataset, int row, int column, boolean selected,
        CategoryItemRendererState state, Rectangle2D result) {

    // nothing is drawn if the row index is not included in the list with
    // the indices of the visible rows...
    int visibleRow = state.getVisibleSeriesIndex(row);
    if (visibleRow < 0) {
        return null;
    }
    if (!this.getItemVisible(row, column)) {
        return null;
    }
    // nothing is drawn for null values...
    Number dataValue = dataset.getValue(row, column);
    if (dataValue == null) {
        return null;
    }

    final double value = dataValue.doubleValue();
    PlotOrientation orientation = plot.getOrientation();
    double barW0 = calculateBarW0(plot, orientation, dataArea, domainAxis,
            state, visibleRow, column);
    double[] barL0L1 = calculateBarL0L1(value, rangeAxis.getLowerBound(),
            rangeAxis.getUpperBound());
    if (barL0L1 == null) {
        return null;  // the bar is not visible
    }

    RectangleEdge edge = plot.getRangeAxisEdge();
    double transL0 = rangeAxis.valueToJava2D(barL0L1[0], dataArea, edge);
    double transL1 = rangeAxis.valueToJava2D(barL0L1[1], dataArea, edge);

    // in the following code, barL0 is (in Java2D coordinates) the LEFT
    // end of the bar for a horizontal bar chart, and the TOP end of the
    // bar for a vertical bar chart.  Whether this is the BASE of the bar
    // or not depends also on (a) whether the data value is 'negative'
    // relative to the base value and (b) whether or not the range axis is
    // inverted.  This only matters if/when we apply the minimumBarLength
    // attribute, because we should extend the non-base end of the bar
    boolean positive = (value >= this.base);
    boolean inverted = rangeAxis.isInverted();
    double barL0 = Math.min(transL0, transL1);
    double barLength = Math.abs(transL1 - transL0);
    double barLengthAdj = 0.0;
    if (barLength > 0.0 && barLength < getMinimumBarLength()) {
        barLengthAdj = getMinimumBarLength() - barLength;
    }
    double barL0Adj = 0.0;
    RectangleEdge barBase;
    if (orientation == PlotOrientation.HORIZONTAL) {
        if (positive && inverted || !positive && !inverted) {
            barL0Adj = barLengthAdj;
            barBase = RectangleEdge.RIGHT;
        }
        else {
            barBase = RectangleEdge.LEFT;
        }
    }
    else {
        if (positive && !inverted || !positive && inverted) {
            barL0Adj = barLengthAdj;
            barBase = RectangleEdge.BOTTOM;
        }
        else {
            barBase = RectangleEdge.TOP;
        }
    }

    // draw the bar...
    Rectangle2D bar = null;
    if (orientation == PlotOrientation.HORIZONTAL) {
        bar = new Rectangle2D.Double(barL0 - barL0Adj, barW0,
                barLength + barLengthAdj, state.getBarWidth());
    }
    else {
        bar = new Rectangle2D.Double(barW0, barL0 - barL0Adj,
                state.getBarWidth(), barLength + barLengthAdj);
    }
    return bar;
}