Search in sources :

Example 1 with AbstractCategoryItemRenderer

use of org.jfree.chart.renderer.category.AbstractCategoryItemRenderer in project SIMVA-SoS by SESoS.

the class CategoryPlot method drawRangeGridlines.

/**
 * Draws the range gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device ({@code null} not permitted).
 * @param dataArea  the area inside the axes ({@code null} not permitted).
 * @param ticks  the ticks.
 *
 * @see #drawDomainGridlines(Graphics2D, Rectangle2D)
 */
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) {
    // draw the range grid lines, if any...
    if (!isRangeGridlinesVisible() && !isRangeMinorGridlinesVisible()) {
        return;
    }
    // no axis, no gridlines...
    ValueAxis axis = getRangeAxis();
    if (axis == null) {
        return;
    }
    // no renderer, no gridlines...
    CategoryItemRenderer r = getRenderer();
    if (r == null) {
        return;
    }
    Stroke gridStroke = null;
    Paint gridPaint = null;
    boolean paintLine;
    Iterator iterator = ticks.iterator();
    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) {
            // interface...
            if (r instanceof AbstractCategoryItemRenderer) {
                AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r;
                aci.drawRangeLine(g2, this, axis, dataArea, tick.getValue(), gridPaint, gridStroke);
            } else {
                // we'll have to use the method in the interface, but
                // this doesn't have the paint and stroke settings...
                r.drawRangeGridline(g2, this, axis, dataArea, tick.getValue());
            }
        }
    }
}
Also used : ValueTick(org.jfree.chart.axis.ValueTick) BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) AbstractCategoryItemRenderer(org.jfree.chart.renderer.category.AbstractCategoryItemRenderer) CategoryItemRenderer(org.jfree.chart.renderer.category.CategoryItemRenderer) ValueAxis(org.jfree.chart.axis.ValueAxis) AbstractCategoryItemRenderer(org.jfree.chart.renderer.category.AbstractCategoryItemRenderer) Iterator(java.util.Iterator) Paint(java.awt.Paint)

Example 2 with AbstractCategoryItemRenderer

use of org.jfree.chart.renderer.category.AbstractCategoryItemRenderer in project SIMVA-SoS by SESoS.

the class CategoryPlot method drawZeroRangeBaseline.

/**
 * Draws a base line across the chart at value zero on the range axis.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 *
 * @see #setRangeZeroBaselineVisible(boolean)
 *
 * @since 1.0.13
 */
protected void drawZeroRangeBaseline(Graphics2D g2, Rectangle2D area) {
    if (!isRangeZeroBaselineVisible()) {
        return;
    }
    CategoryItemRenderer r = getRenderer();
    if (r instanceof AbstractCategoryItemRenderer) {
        AbstractCategoryItemRenderer aci = (AbstractCategoryItemRenderer) r;
        aci.drawRangeLine(g2, this, getRangeAxis(), area, 0.0, this.rangeZeroBaselinePaint, this.rangeZeroBaselineStroke);
    } else {
        r.drawRangeGridline(g2, this, getRangeAxis(), area, 0.0);
    }
}
Also used : AbstractCategoryItemRenderer(org.jfree.chart.renderer.category.AbstractCategoryItemRenderer) CategoryItemRenderer(org.jfree.chart.renderer.category.CategoryItemRenderer) AbstractCategoryItemRenderer(org.jfree.chart.renderer.category.AbstractCategoryItemRenderer)

Aggregations

AbstractCategoryItemRenderer (org.jfree.chart.renderer.category.AbstractCategoryItemRenderer)2 CategoryItemRenderer (org.jfree.chart.renderer.category.CategoryItemRenderer)2 BasicStroke (java.awt.BasicStroke)1 Paint (java.awt.Paint)1 Stroke (java.awt.Stroke)1 Iterator (java.util.Iterator)1 ValueAxis (org.jfree.chart.axis.ValueAxis)1 ValueTick (org.jfree.chart.axis.ValueTick)1