Java Code Examples for org.jfree.chart.plot.XYPlot#getRangeTickBandPaint()

The following examples show how to use org.jfree.chart.plot.XYPlot#getRangeTickBandPaint() . 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: AbstractXYItemRenderer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
@Override
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
        Rectangle2D dataArea, double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea,
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    Rectangle2D band;
    if (plot.getOrientation() == PlotOrientation.VERTICAL) {
        band = new Rectangle2D.Double(dataArea.getMinX(), Math.min(y1, y2),
            dataArea.getWidth(), Math.abs(y2 - y1));
    }
    else {
        band = new Rectangle2D.Double(Math.min(y1, y2), dataArea.getMinY(),
                Math.abs(y2 - y1), dataArea.getHeight());
    }
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}
 
Example 2
Source File: AbstractXYItemRenderer.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
@Override
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
        Rectangle2D dataArea, double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea,
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    Rectangle2D band;
    if (plot.getOrientation() == PlotOrientation.VERTICAL) {
        band = new Rectangle2D.Double(dataArea.getMinX(), Math.min(y1, y2),
            dataArea.getWidth(), Math.abs(y2 - y1));
    }
    else {
        band = new Rectangle2D.Double(Math.min(y1, y2), dataArea.getMinY(),
                Math.abs(y2 - y1), dataArea.getHeight());
    }
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}
 
Example 3
Source File: AbstractXYItemRenderer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
@Override
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
        Rectangle2D dataArea, double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea,
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    Rectangle2D band;
    if (plot.getOrientation() == PlotOrientation.VERTICAL) {
        band = new Rectangle2D.Double(dataArea.getMinX(), Math.min(y1, y2),
            dataArea.getWidth(), Math.abs(y2 - y1));
    }
    else {
        band = new Rectangle2D.Double(Math.min(y1, y2), dataArea.getMinY(),
                Math.abs(y2 - y1), dataArea.getHeight());
    }
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}
 
Example 4
Source File: AbstractXYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
@Override
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
        Rectangle2D dataArea, double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea,
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    Rectangle2D band;
    if (plot.getOrientation() == PlotOrientation.VERTICAL) {
        band = new Rectangle2D.Double(dataArea.getMinX(), Math.min(y1, y2),
            dataArea.getWidth(), Math.abs(y2 - y1));
    }
    else {
        band = new Rectangle2D.Double(Math.min(y1, y2), dataArea.getMinY(),
                Math.abs(y2 - y1), dataArea.getHeight());
    }
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}
 
Example 5
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
        Rectangle2D dataArea, double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea,
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    Rectangle2D band;
    if (plot.getOrientation() == PlotOrientation.VERTICAL) {
        band = new Rectangle2D.Double(dataArea.getMinX(), Math.min(y1, y2),
            dataArea.getWidth(), Math.abs(y2 - y1));
    }
    else {
        band = new Rectangle2D.Double(Math.min(y1, y2), dataArea.getMinY(),
                Math.abs(y2 - y1), dataArea.getHeight());
    }
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}
 
Example 6
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
        Rectangle2D dataArea, double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea, 
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    Rectangle2D band;
    if (plot.getOrientation() == PlotOrientation.VERTICAL) {
        band = new Rectangle2D.Double(dataArea.getMinX(), Math.min(y1, y2),
            dataArea.getWidth(), Math.abs(y2 - y1));
    }
    else {
        band = new Rectangle2D.Double(Math.min(y1, y2), dataArea.getMinY(),
                Math.abs(y2 - y1), dataArea.getHeight());
    }
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}
 
Example 7
Source File: AbstractXYItemRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to 
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
public void fillRangeGridBand(Graphics2D g2,
                              XYPlot plot,
                              ValueAxis axis,
                              Rectangle2D dataArea,
                              double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea, 
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    // TODO: need to change the next line to take account of the plot 
    //       orientation
    Rectangle2D band = new Rectangle2D.Double(dataArea.getMinX(), y2, 
            dataArea.getWidth(), y1 - y2);
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}
 
Example 8
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
@Override
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
        Rectangle2D dataArea, double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea,
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    Rectangle2D band;
    if (plot.getOrientation() == PlotOrientation.VERTICAL) {
        band = new Rectangle2D.Double(dataArea.getMinX(), Math.min(y1, y2),
            dataArea.getWidth(), Math.abs(y2 - y1));
    }
    else {
        band = new Rectangle2D.Double(Math.min(y1, y2), dataArea.getMinY(),
                Math.abs(y2 - y1), dataArea.getHeight());
    }
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}
 
Example 9
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Fills a band between two values on the range axis.  This can be used to
 * color bands between the grid lines.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param axis  the range axis.
 * @param dataArea  the data area.
 * @param start  the start value.
 * @param end  the end value.
 */
@Override
public void fillRangeGridBand(Graphics2D g2, XYPlot plot, ValueAxis axis,
        Rectangle2D dataArea, double start, double end) {

    double y1 = axis.valueToJava2D(start, dataArea,
            plot.getRangeAxisEdge());
    double y2 = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
    Rectangle2D band;
    if (plot.getOrientation() == PlotOrientation.VERTICAL) {
        band = new Rectangle2D.Double(dataArea.getMinX(), Math.min(y1, y2),
            dataArea.getWidth(), Math.abs(y2 - y1));
    }
    else {
        band = new Rectangle2D.Double(Math.min(y1, y2), dataArea.getMinY(),
                Math.abs(y2 - y1), dataArea.getHeight());
    }
    Paint paint = plot.getRangeTickBandPaint();

    if (paint != null) {
        g2.setPaint(paint);
        g2.fill(band);
    }

}