org.jfree.chart.renderer.xy.AbstractXYItemRenderer Java Examples

The following examples show how to use org.jfree.chart.renderer.xy.AbstractXYItemRenderer. 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: BlockChartPlotter.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public AbstractXYItemRenderer getItemRenderer(boolean nominal, int size, double minColor, double maxColor) {
	XYBlockRenderer renderer = new XYBlockRenderer();
	renderer.setPaintScale(new BlockPaintScale(minColor, maxColor));
	renderer.setBlockAnchor(RectangleAnchor.CENTER);

	// if Block dimension is increased (e.g 1.2x1.2), the grid effect gets bigger
	// so it could be that blocks are overlapping a little
	// but if Block dimension is decreased (e.g. 0.9x0.9), each rectangle seems to have
	// a less-transparent border (you have to zoom-in to notice), and that could be the cause of
	// the grid effect.
	// renderer.setBlockHeight(1.0);
	// renderer.setBlockWidth(1.0);

	return renderer;
}
 
Example #2
Source File: Cardumen_0082_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine = false;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            }
            else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #3
Source File: XYPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a base line across the chart at value zero on the domain axis.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 *
 * @see #setDomainZeroBaselineVisible(boolean)
 *
 * @since 1.0.5
 */
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
    if (isDomainZeroBaselineVisible()) {
        XYItemRenderer r = getRenderer();
        // FIXME: the renderer interface doesn't have the drawDomainLine()
        // method, so we have to rely on the renderer being a subclass of
        // AbstractXYItemRenderer (which is lame)
        if (r instanceof AbstractXYItemRenderer) {
            AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
            renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
                    this.domainZeroBaselinePaint,
                    this.domainZeroBaselineStroke);
        }
    }
}
 
Example #4
Source File: XYPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            } else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #5
Source File: XYPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a base line across the chart at value zero on the domain axis.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 *
 * @see #setDomainZeroBaselineVisible(boolean)
 *
 * @since 1.0.5
 */
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
    if (isDomainZeroBaselineVisible()) {
        XYItemRenderer r = getRenderer();
        // FIXME: the renderer interface doesn't have the drawDomainLine()
        // method, so we have to rely on the renderer being a subclass of
        // AbstractXYItemRenderer (which is lame)
        if (r instanceof AbstractXYItemRenderer) {
            AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
            renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
                    this.domainZeroBaselinePaint,
                    this.domainZeroBaselineStroke);
        }
    }
}
 
Example #6
Source File: XYPlot.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            } else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #7
Source File: AbstractXYItemRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the findDomainBounds() method.
 */
public void testFindDomainBounds() {
    AbstractXYItemRenderer renderer = new StandardXYItemRenderer();
    
    // check the bounds of a simple dataset
    XYDataset dataset = createDataset1();
    Range r = renderer.findDomainBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);
    
    // check that a null dataset returns null bounds
    assertTrue(renderer.findDomainBounds(null) == null);
}
 
Example #8
Source File: AbstractXYItemRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some checks for the findDomainBounds() method.
 */
public void testFindDomainBounds() {
    AbstractXYItemRenderer renderer = new StandardXYItemRenderer();

    // check the bounds of a simple dataset
    XYDataset dataset = createDataset1();
    Range r = renderer.findDomainBounds(dataset);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(3.0, r.getUpperBound(), EPSILON);

    // check that a null dataset returns null bounds
    assertTrue(renderer.findDomainBounds(null) == null);
}
 
Example #9
Source File: XYPlot.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Draws a base line across the chart at value zero on the domain axis.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 *
 * @see #setDomainZeroBaselineVisible(boolean)
 *
 * @since 1.0.5
 */
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
    if (isDomainZeroBaselineVisible()) {
        XYItemRenderer r = getRenderer();
        // FIXME: the renderer interface doesn't have the drawDomainLine()
        // method, so we have to rely on the renderer being a subclass of
        // AbstractXYItemRenderer (which is lame)
        if (r instanceof AbstractXYItemRenderer) {
            AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
            renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
                    this.domainZeroBaselinePaint,
                    this.domainZeroBaselineStroke);
        }
    }
}
 
Example #10
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, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            } else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #11
Source File: ChartJFreeChartOutputScatter.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setUseSize(final IScope scope, final String name, final boolean b) {
	// TODO Auto-generated method stub
	final AbstractXYItemRenderer newr = (AbstractXYItemRenderer) this.getOrCreateRenderer(scope, name);
	if (newr instanceof myXYErrorRenderer) {
		((myXYErrorRenderer) newr).setUseSize(scope, b);
	}

}
 
Example #12
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, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            } else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #13
Source File: Cardumen_0082_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine = false;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            }
            else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #14
Source File: Cardumen_009_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine = false;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            }
            else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #15
Source File: Cardumen_009_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine = false;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            }
            else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #16
Source File: XYPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Draws a base line across the chart at value zero on the domain axis.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 *
 * @see #setDomainZeroBaselineVisible(boolean)
 *
 * @since 1.0.5
 */
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
    if (isDomainZeroBaselineVisible()) {
        XYItemRenderer r = getRenderer();
        // FIXME: the renderer interface doesn't have the drawDomainLine()
        // method, so we have to rely on the renderer being a subclass of
        // AbstractXYItemRenderer (which is lame)
        if (r instanceof AbstractXYItemRenderer) {
            AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
            renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
                    this.domainZeroBaselinePaint,
                    this.domainZeroBaselineStroke);
        }
    }
}
 
Example #17
Source File: XYPlot.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            } else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #18
Source File: XYPlot.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a base line across the chart at value zero on the domain axis.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 *
 * @see #setDomainZeroBaselineVisible(boolean)
 *
 * @since 1.0.5
 */
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
    if (isDomainZeroBaselineVisible()) {
        XYItemRenderer r = getRenderer();
        // FIXME: the renderer interface doesn't have the drawDomainLine()
        // method, so we have to rely on the renderer being a subclass of
        // AbstractXYItemRenderer (which is lame)
        if (r instanceof AbstractXYItemRenderer) {
            AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
            renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
                    this.domainZeroBaselinePaint,
                    this.domainZeroBaselineStroke);
        }
    }
}
 
Example #19
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, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 *
 * @see #drawRangeGridlines(Graphics2D, Rectangle2D, List)
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

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

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible() || isDomainMinorGridlinesVisible()) {
        Stroke gridStroke = null;
        Paint gridPaint = null;
        Iterator iterator = ticks.iterator();
        boolean paintLine;
        while (iterator.hasNext()) {
            paintLine = false;
            ValueTick tick = (ValueTick) iterator.next();
            if ((tick.getTickType() == TickType.MINOR)
                    && isDomainMinorGridlinesVisible()) {
                gridStroke = getDomainMinorGridlineStroke();
                gridPaint = getDomainMinorGridlinePaint();
                paintLine = true;
            } else if ((tick.getTickType() == TickType.MAJOR)
                    && isDomainGridlinesVisible()) {
                gridStroke = getDomainGridlineStroke();
                gridPaint = getDomainGridlinePaint();
                paintLine = true;
            }
            XYItemRenderer r = getRenderer();
            if ((r instanceof AbstractXYItemRenderer) && paintLine) {
                ((AbstractXYItemRenderer) r).drawDomainLine(g2, this,
                        getDomainAxis(), dataArea, tick.getValue(),
                        gridPaint, gridStroke);
            }
        }
    }
}
 
Example #20
Source File: XYPlot.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Draws a base line across the chart at value zero on the domain axis.
 *
 * @param g2  the graphics device.
 * @param area  the data area.
 *
 * @see #setDomainZeroBaselineVisible(boolean)
 *
 * @since 1.0.5
 */
protected void drawZeroDomainBaseline(Graphics2D g2, Rectangle2D area) {
    if (isDomainZeroBaselineVisible()) {
        XYItemRenderer r = getRenderer();
        // FIXME: the renderer interface doesn't have the drawDomainLine()
        // method, so we have to rely on the renderer being a subclass of
        // AbstractXYItemRenderer (which is lame)
        if (r instanceof AbstractXYItemRenderer) {
            AbstractXYItemRenderer renderer = (AbstractXYItemRenderer) r;
            renderer.drawDomainLine(g2, this, getDomainAxis(), area, 0.0,
                    this.domainZeroBaselinePaint,
                    this.domainZeroBaselineStroke);
        }
    }
}
 
Example #21
Source File: ChartJFreeChartOutputScatter.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
protected void resetRenderer(final IScope scope, final String serieid) {
	final AbstractXYItemRenderer newr = (AbstractXYItemRenderer) this.getOrCreateRenderer(scope, serieid);
	// newr.setSeriesStroke(0, new BasicStroke(0));
	newr.setDefaultCreateEntities(true);
	final ChartDataSeries myserie = this.getChartdataset().getDataSeries(scope, serieid);

	if (newr instanceof XYLineAndShapeRenderer) {
		((XYLineAndShapeRenderer) newr).setSeriesLinesVisible(0, myserie.getMysource().showLine);
		((XYLineAndShapeRenderer) newr).setSeriesShapesFilled(0, myserie.getMysource().fillMarker);
		((XYLineAndShapeRenderer) newr).setSeriesShapesVisible(0, myserie.getMysource().useMarker);

	}

	if (newr instanceof XYShapeRenderer) {
		if (!myserie.getMysource().fillMarker) {
			((XYShapeRenderer) newr).setUseFillPaint(false);
			// ((XYShapeRenderer) newr).setDrawOutlines(true);
		}
	}
	if (myserie.getMycolor() != null) {
		newr.setSeriesPaint(0, myserie.getMycolor());
	}
	newr.setSeriesStroke(0, new BasicStroke((float) myserie.getLineThickness()));

	if (newr instanceof myXYErrorRenderer) {
		((myXYErrorRenderer) newr).setDrawYError(false);
		((myXYErrorRenderer) newr).setDrawXError(false);
		if (myserie.isUseYErrValues()) {
			((myXYErrorRenderer) newr).setDrawYError(true);
		}
		if (myserie.isUseXErrValues()) {
			((myXYErrorRenderer) newr).setDrawXError(true);
		}
		if (myserie.getMysource().isUseSize()) {
			((myXYErrorRenderer) newr).setUseSize(scope, true);
		}
	}

	if (myserie.getMysource().getUniqueMarkerName() != null) {
		setSerieMarkerShape(scope, myserie.getName(), myserie.getMysource().getUniqueMarkerName());
	}

}
 
Example #22
Source File: MsSpectrumPlotWindowController.java    From old-mzmine3 with GNU General Public License v2.0 4 votes vote down vote up
private void configureRenderer(MsSpectrumDataSet dataset, int datasetIndex) {

    final MsSpectrumType renderingType = dataset.getRenderingType();
    final XYPlot plot = chartNode.getChart().getXYPlot();

    // Set renderer
    AbstractXYItemRenderer newRenderer;
    switch (renderingType) {
      case PROFILE:
      case THRESHOLDED:
        XYLineAndShapeRenderer newLineRenderer = new XYLineAndShapeRenderer();
        final int lineThickness = dataset.getLineThickness();
        newLineRenderer.setBaseShape(new Ellipse2D.Double(-2 * lineThickness, -2 * lineThickness,
            4 * lineThickness + 1, 4 * lineThickness + 1));
        newLineRenderer.setBaseShapesFilled(true);
        newLineRenderer.setBaseShapesVisible(dataset.getShowDataPoints());
        newLineRenderer.setDrawOutlines(false);

        Stroke baseStroke = new BasicStroke(lineThickness);
        newLineRenderer.setBaseStroke(baseStroke);
        newRenderer = newLineRenderer;
        break;
      case CENTROIDED:
      default:
        XYBarRenderer newBarRenderer = new XYBarRenderer();
        // Avoid gradients
        newBarRenderer.setBarPainter(new StandardXYBarPainter());
        newBarRenderer.setShadowVisible(false);
        newRenderer = newBarRenderer;
        break;
    }

    // Set tooltips for legend
    newRenderer.setLegendItemToolTipGenerator((ds, series) -> {
      if (ds instanceof MsSpectrumDataSet) {
        return ((MsSpectrumDataSet) ds).getDescription();
      } else
        return null;
    });

    // Set color
    Color baseColor = dataset.getColor();
    newRenderer.setBasePaint(JavaFXUtil.convertColorToAWT(baseColor));

    // Set label generator
    XYItemLabelGenerator intelligentLabelGenerator =
        new IntelligentItemLabelGenerator(chartNode, 100, dataset);
    newRenderer.setBaseItemLabelGenerator(intelligentLabelGenerator);
    newRenderer.setBaseItemLabelPaint(JavaFXUtil.convertColorToAWT(labelsColor));
    newRenderer.setBaseItemLabelsVisible(itemLabelsVisible.get());

    // Set tooltip generator
    newRenderer.setBaseToolTipGenerator(dataset);

    plot.setRenderer(datasetIndex, newRenderer);

  }
 
Example #23
Source File: Abstract2DChartPlotter.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/** Subclasses have to implement this method. */
public abstract AbstractXYItemRenderer getItemRenderer(boolean nominal, int size, double minColor, double maxColor);
 
Example #24
Source File: AbstractXYItemRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Some checks for the findRangeBounds() method.
 */
public void testFindRangeBounds() {
    AbstractXYItemRenderer renderer = new StandardXYItemRenderer();
    // check that a null dataset returns null bounds
    assertTrue(renderer.findRangeBounds(null) == null);
}
 
Example #25
Source File: AbstractXYItemRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Some checks for the findRangeBounds() method.
 */
public void testFindRangeBounds() {
    AbstractXYItemRenderer renderer = new StandardXYItemRenderer();
    // check that a null dataset returns null bounds
    assertTrue(renderer.findRangeBounds(null) == null);
}