Search in sources :

Example 6 with ValueTick

use of org.jfree.chart.axis.ValueTick in project SIMVA-SoS by SESoS.

the class FastScatterPlot method drawDomainGridlines.

/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) {
    if (!isDomainGridlinesVisible()) {
        return;
    }
    Object saved = g2.getRenderingHint(RenderingHints.KEY_STROKE_CONTROL);
    g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
    Iterator iterator = ticks.iterator();
    while (iterator.hasNext()) {
        ValueTick tick = (ValueTick) iterator.next();
        double v = this.domainAxis.valueToJava2D(tick.getValue(), dataArea, RectangleEdge.BOTTOM);
        Line2D line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
        g2.setPaint(getDomainGridlinePaint());
        g2.setStroke(getDomainGridlineStroke());
        g2.draw(line);
    }
    g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, saved);
}
Also used : ValueTick(org.jfree.chart.axis.ValueTick) Iterator(java.util.Iterator) Line2D(java.awt.geom.Line2D)

Example 7 with ValueTick

use of org.jfree.chart.axis.ValueTick in project SIMVA-SoS by SESoS.

the class XYPlot method drawRangeTickBands.

/**
 * 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);
        }
    }
}
Also used : ValueTick(org.jfree.chart.axis.ValueTick) ValueAxis(org.jfree.chart.axis.ValueAxis) Iterator(java.util.Iterator) Paint(java.awt.Paint)

Example 8 with ValueTick

use of org.jfree.chart.axis.ValueTick in project SIMVA-SoS by SESoS.

the class XYPlot method drawDomainTickBands.

/**
 * 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);
        }
    }
}
Also used : ValueTick(org.jfree.chart.axis.ValueTick) ValueAxis(org.jfree.chart.axis.ValueAxis) Iterator(java.util.Iterator) Paint(java.awt.Paint)

Aggregations

Iterator (java.util.Iterator)8 ValueTick (org.jfree.chart.axis.ValueTick)8 Paint (java.awt.Paint)5 ValueAxis (org.jfree.chart.axis.ValueAxis)4 BasicStroke (java.awt.BasicStroke)3 Stroke (java.awt.Stroke)3 Line2D (java.awt.geom.Line2D)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AbstractCategoryItemRenderer (org.jfree.chart.renderer.category.AbstractCategoryItemRenderer)1 CategoryItemRenderer (org.jfree.chart.renderer.category.CategoryItemRenderer)1 AbstractXYItemRenderer (org.jfree.chart.renderer.xy.AbstractXYItemRenderer)1 XYItemRenderer (org.jfree.chart.renderer.xy.XYItemRenderer)1 ObjectList (org.jfree.util.ObjectList)1