Java Code Examples for org.jfree.chart.axis.ValueTick#getValue()

The following examples show how to use org.jfree.chart.axis.ValueTick#getValue() . 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: Cardumen_009_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws the range tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #setRangeTickBandPaint(Paint)
 */
public void drawRangeTickBands(Graphics2D g2, Rectangle2D dataArea,
                               List ticks) {
    Paint bandPaint = getRangeTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis axis = getRangeAxis();
        double previous = axis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillRangeGridBand(g2, this, axis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = axis.getUpperBound();
        if (fillBand) {
            getRenderer().fillRangeGridBand(g2, this, axis, dataArea,
                    previous, end);
        }
    }
}
 
Example 2
Source File: Cardumen_0082_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                    previous, end);
        }
    }
}
 
Example 3
Source File: XYPlot.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                    previous, end);
        }
    }
}
 
Example 4
Source File: XYPlot.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 * 
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea, 
                    previous, end);
        }
    }
}
 
Example 5
Source File: Cardumen_0082_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                    previous, end);
        }
    }
}
 
Example 6
Source File: XYPlot.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                    previous, end);
        }
    }
}
 
Example 7
Source File: 1_XYPlot.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the range tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 * 
 * @see #setRangeTickBandPaint(Paint)
 */
public void drawRangeTickBands(Graphics2D g2, Rectangle2D dataArea,
                               List ticks) {
    Paint bandPaint = getRangeTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis axis = getRangeAxis();
        double previous = axis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillRangeGridBand(g2, this, axis, dataArea, 
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = axis.getUpperBound();
        if (fillBand) {
            getRenderer().fillRangeGridBand(g2, this, axis, dataArea, 
                    previous, end);
        }
    }
}
 
Example 8
Source File: Chart_14_XYPlot_t.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 * 
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea, 
                    previous, end);
        }
    }
}
 
Example 9
Source File: 1_XYPlot.java    From SimFix with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the range tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 * 
 * @see #setRangeTickBandPaint(Paint)
 */
public void drawRangeTickBands(Graphics2D g2, Rectangle2D dataArea,
                               List ticks) {
    Paint bandPaint = getRangeTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis axis = getRangeAxis();
        double previous = axis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillRangeGridBand(g2, this, axis, dataArea, 
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = axis.getUpperBound();
        if (fillBand) {
            getRenderer().fillRangeGridBand(g2, this, axis, dataArea, 
                    previous, end);
        }
    }
}
 
Example 10
Source File: XYPlot.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the range tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 * 
 * @see #setRangeTickBandPaint(Paint)
 */
public void drawRangeTickBands(Graphics2D g2, Rectangle2D dataArea,
                               List ticks) {
    Paint bandPaint = getRangeTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis axis = getRangeAxis();
        double previous = axis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillRangeGridBand(g2, this, axis, dataArea, 
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = axis.getUpperBound();
        if (fillBand) {
            getRenderer().fillRangeGridBand(g2, this, axis, dataArea, 
                    previous, end);
        }
    }
}
 
Example 11
Source File: Chart_14_XYPlot_s.java    From coming with MIT License 6 votes vote down vote up
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 * 
 * @see #setDomainTickBandPaint(Paint)
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea,
                                List ticks) {
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea,
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea, 
                    previous, end);
        }
    }
}
 
Example 12
Source File: 1_XYPlot.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draws the gridlines for the plot's primary range axis, if they are
 * visible.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 * @param ticks  the ticks.
 * 
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area,
                                  List ticks) {

    // no renderer, no gridlines...
    if (getRenderer() == null) {
        return;
    }

    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible()) {
        Stroke gridStroke = getRangeGridlineStroke();
        Paint gridPaint = getRangeGridlinePaint();
        ValueAxis axis = getRangeAxis();
        if (axis != null) {
            Iterator iterator = ticks.iterator();
            while (iterator.hasNext()) {
                ValueTick tick = (ValueTick) iterator.next();
                if (tick.getValue() != 0.0
                        || !isRangeZeroBaselineVisible()) {
                    getRenderer().drawRangeLine(g2, this, getRangeAxis(), 
                            area, tick.getValue(), gridPaint, gridStroke);
                }
            }
        }
    }
}
 
Example 13
Source File: XYPlot.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws the gridlines for the plot's primary range axis, if they are
 * visible.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area,
                                  List ticks) {

    // no renderer, no gridlines...
    if (getRenderer() == null) {
        return;
    }

    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible() || isRangeMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        ValueAxis axis = getRangeAxis();
        if (axis != null) {
            Iterator iterator = ticks.iterator();
            boolean paintLine;
            while (iterator.hasNext()) {
                paintLine = false;
                ValueTick tick = (ValueTick) iterator.next();
                if ((tick.getTickType() == TickType.MINOR)
                        && isRangeMinorGridlinesVisible()) {
                    gridStroke = getRangeMinorGridlineStroke();
                    gridPaint = getRangeMinorGridlinePaint();
                    paintLine = true;
                } else if ((tick.getTickType() == TickType.MAJOR)
                        && isRangeGridlinesVisible()) {
                    gridStroke = getRangeGridlineStroke();
                    gridPaint = getRangeGridlinePaint();
                    paintLine = true;
                }
                if ((tick.getValue() != 0.0
                        || !isRangeZeroBaselineVisible()) && paintLine) {
                    getRenderer().drawRangeLine(g2, this, getRangeAxis(),
                            area, tick.getValue(), gridPaint, gridStroke);
                }
            }
        }
    }
}
 
Example 14
Source File: XYPlot.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws the gridlines for the plot's primary range axis, if they are
 * visible.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area,
                                  List ticks) {

    // no renderer, no gridlines...
    if (getRenderer() == null) {
        return;
    }

    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible() || isRangeMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        ValueAxis axis = getRangeAxis();
        if (axis != null) {
            Iterator iterator = ticks.iterator();
            boolean paintLine;
            while (iterator.hasNext()) {
                paintLine = false;
                ValueTick tick = (ValueTick) iterator.next();
                if ((tick.getTickType() == TickType.MINOR)
                        && isRangeMinorGridlinesVisible()) {
                    gridStroke = getRangeMinorGridlineStroke();
                    gridPaint = getRangeMinorGridlinePaint();
                    paintLine = true;
                } else if ((tick.getTickType() == TickType.MAJOR)
                        && isRangeGridlinesVisible()) {
                    gridStroke = getRangeGridlineStroke();
                    gridPaint = getRangeGridlinePaint();
                    paintLine = true;
                }
                if ((tick.getValue() != 0.0
                        || !isRangeZeroBaselineVisible()) && paintLine) {
                    getRenderer().drawRangeLine(g2, this, getRangeAxis(),
                            area, tick.getValue(), gridPaint, gridStroke);
                }
            }
        }
    }
}
 
Example 15
Source File: XYPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Draws the gridlines for the plot's primary range axis, if they are
 * visible.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area,
                                  List ticks) {

    // no renderer, no gridlines...
    if (getRenderer() == null) {
        return;
    }

    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible() || isRangeMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        ValueAxis axis = getRangeAxis();
        if (axis != null) {
            Iterator iterator = ticks.iterator();
            boolean paintLine;
            while (iterator.hasNext()) {
                paintLine = false;
                ValueTick tick = (ValueTick) iterator.next();
                if ((tick.getTickType() == TickType.MINOR)
                        && isRangeMinorGridlinesVisible()) {
                    gridStroke = getRangeMinorGridlineStroke();
                    gridPaint = getRangeMinorGridlinePaint();
                    paintLine = true;
                } else if ((tick.getTickType() == TickType.MAJOR)
                        && isRangeGridlinesVisible()) {
                    gridStroke = getRangeGridlineStroke();
                    gridPaint = getRangeGridlinePaint();
                    paintLine = true;
                }
                if ((tick.getValue() != 0.0
                        || !isRangeZeroBaselineVisible()) && paintLine) {
                    getRenderer().drawRangeLine(g2, this, getRangeAxis(),
                            area, tick.getValue(), gridPaint, gridStroke);
                }
            }
        }
    }
}
 
Example 16
Source File: XYPlot.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draws the gridlines for the plot's primary range axis, if they are
 * visible.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area,
                                  List ticks) {

    // no renderer, no gridlines...
    if (getRenderer() == null) {
        return;
    }

    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible() || isRangeMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        ValueAxis axis = getRangeAxis();
        if (axis != null) {
            Iterator iterator = ticks.iterator();
            boolean paintLine;
            while (iterator.hasNext()) {
                paintLine = false;
                ValueTick tick = (ValueTick) iterator.next();
                if ((tick.getTickType() == TickType.MINOR)
                        && isRangeMinorGridlinesVisible()) {
                    gridStroke = getRangeMinorGridlineStroke();
                    gridPaint = getRangeMinorGridlinePaint();
                    paintLine = true;
                } else if ((tick.getTickType() == TickType.MAJOR)
                        && isRangeGridlinesVisible()) {
                    gridStroke = getRangeGridlineStroke();
                    gridPaint = getRangeGridlinePaint();
                    paintLine = true;
                }
                if ((tick.getValue() != 0.0
                        || !isRangeZeroBaselineVisible()) && paintLine) {
                    getRenderer().drawRangeLine(g2, this, getRangeAxis(),
                            area, tick.getValue(), gridPaint, gridStroke);
                }
            }
        }
    }
}
 
Example 17
Source File: WeightBasedSymbolAxis.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Draws the grid bands for the axis when it is at the top or bottom of the plot.
 * 
 * @param g2
 *            the graphics device.
 * @param drawArea
 *            the area within which the chart should be drawn.
 * @param plotArea
 *            the area within which the plot should be drawn (a subset of the drawArea).
 * @param firstGridBandIsDark
 *            True: the first grid band takes the color of <CODE>gridBandPaint<CODE>. False: the
 *            second grid band takes the color of <CODE>gridBandPaint<CODE>.
 * @param ticks
 *            a list of ticks.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void drawGridBandsVertical(Graphics2D g2, Rectangle2D drawArea, Rectangle2D plotArea,
		boolean firstGridBandIsDark, List ticks) {
	double xx = plotArea.getX();
	double yy1, yy2;

	// gets the outline stroke width of the plot
	double outlineStrokeWidth;
	Stroke outlineStroke = getPlot().getOutlineStroke();
	if (outlineStroke != null && outlineStroke instanceof BasicStroke) {
		outlineStrokeWidth = ((BasicStroke) outlineStroke).getLineWidth();
	} else {
		outlineStrokeWidth = 1d;
	}

	Rectangle2D band;
	for (ValueTick tick : (List<ValueTick>) ticks) {
		int weightIndex = (int) tick.getValue();
		yy1 = valueToJava2D(tick.getValue() + 0.5d, plotArea, RectangleEdge.LEFT);
		yy2 = valueToJava2D(tick.getValue() - 0.5d, plotArea, RectangleEdge.LEFT);

		g2.setColor(PlotterAdapter.getWeightColor(this.weights[weightIndex], this.maxWeight));

		band = new Rectangle2D.Double(xx + outlineStrokeWidth, yy1, plotArea.getMaxX() - xx - outlineStrokeWidth,
				yy2 - yy1);
		g2.fill(band);
	}
	g2.setPaintMode();
}
 
Example 18
Source File: WeightBasedSymbolAxis.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Draws the grid bands for the axis when it is at the top or bottom of the plot.
 * 
 * @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 firstGridBandIsDark
 *            True: the first grid band takes the color of <CODE>gridBandPaint<CODE>. False: the
 *            second grid band takes the color of <CODE>gridBandPaint<CODE>.
 * @param ticks
 *            the ticks.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void drawGridBandsHorizontal(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea,
		boolean firstGridBandIsDark, List ticks) {
	double yy = dataArea.getY();
	double xx1, xx2;

	// gets the outline stroke width of the plot
	double outlineStrokeWidth;
	if (getPlot().getOutlineStroke() != null) {
		outlineStrokeWidth = ((BasicStroke) getPlot().getOutlineStroke()).getLineWidth();
	} else {
		outlineStrokeWidth = 1d;
	}

	Rectangle2D band;
	for (ValueTick tick : (List<ValueTick>) ticks) {
		int weightIndex = (int) tick.getValue();
		xx1 = valueToJava2D(tick.getValue() - 0.5d, dataArea, RectangleEdge.BOTTOM);
		xx2 = valueToJava2D(tick.getValue() + 0.5d, dataArea, RectangleEdge.BOTTOM);

		g2.setColor(PlotterAdapter.getWeightColor(this.weights[weightIndex], this.maxWeight));

		band = new Rectangle2D.Double(xx1, yy + outlineStrokeWidth, xx2 - xx1,
				dataArea.getMaxY() - yy - outlineStrokeWidth);
		g2.fill(band);
	}
	g2.setPaintMode();
}
 
Example 19
Source File: Cardumen_009_t.java    From coming with MIT License 4 votes vote down vote up
/**
 * Draws the gridlines for the plot's primary range axis, if they are
 * visible.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area,
                                  List ticks) {

    // no renderer, no gridlines...
    if (getRenderer() == null) {
        return;
    }

    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible() || isRangeMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        ValueAxis axis = getRangeAxis();
        if (axis != null) {
            Iterator iterator = ticks.iterator();
            boolean paintLine = false;
            while (iterator.hasNext()) {
                paintLine = false;
                ValueTick tick = (ValueTick) iterator.next();
                if ((tick.getTickType() == TickType.MINOR)
                        && isRangeMinorGridlinesVisible()) {
                    gridStroke = getRangeMinorGridlineStroke();
                    gridPaint = getRangeMinorGridlinePaint();
                    paintLine = true;
                }
                else if ((tick.getTickType() == TickType.MAJOR)
                        && isRangeGridlinesVisible()) {
                    gridStroke = getRangeGridlineStroke();
                    gridPaint = getRangeGridlinePaint();
                    paintLine = true;
                }
                if ((tick.getValue() != 0.0
                        || !isRangeZeroBaselineVisible()) && paintLine) {
                    getRenderer().drawRangeLine(g2, this, getRangeAxis(),
                            area, tick.getValue(), gridPaint, gridStroke);
                }
            }
        }
    }
}
 
Example 20
Source File: Cardumen_009_s.java    From coming with MIT License 4 votes vote down vote up
/**
 * Draws the gridlines for the plot's primary range axis, if they are
 * visible.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D area,
                                  List ticks) {

    // no renderer, no gridlines...
    if (getRenderer() == null) {
        return;
    }

    // draw the range grid lines, if any...
    if (isRangeGridlinesVisible() || isRangeMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        ValueAxis axis = getRangeAxis();
        if (axis != null) {
            Iterator iterator = ticks.iterator();
            boolean paintLine = false;
            while (iterator.hasNext()) {
                paintLine = false;
                ValueTick tick = (ValueTick) iterator.next();
                if ((tick.getTickType() == TickType.MINOR)
                        && isRangeMinorGridlinesVisible()) {
                    gridStroke = getRangeMinorGridlineStroke();
                    gridPaint = getRangeMinorGridlinePaint();
                    paintLine = true;
                }
                else if ((tick.getTickType() == TickType.MAJOR)
                        && isRangeGridlinesVisible()) {
                    gridStroke = getRangeGridlineStroke();
                    gridPaint = getRangeGridlinePaint();
                    paintLine = true;
                }
                if ((tick.getValue() != 0.0
                        || !isRangeZeroBaselineVisible()) && paintLine) {
                    getRenderer().drawRangeLine(g2, this, getRangeAxis(),
                            area, tick.getValue(), gridPaint, gridStroke);
                }
            }
        }
    }
}