Example usage for org.jfree.chart.plot MeterInterval getRange

List of usage examples for org.jfree.chart.plot MeterInterval getRange

Introduction

In this page you can find the example usage for org.jfree.chart.plot MeterInterval getRange.

Prototype

public Range getRange() 

Source Link

Document

Returns the range.

Usage

From source file:edu.cuny.jfree.chart.plot.MyMeterPlot.java

/**
 * Draws the arc to represent an interval.
 * /* w  ww  . j  ava 2  s. co m*/
 * @param g2
 *          the graphics device.
 * @param meterArea
 *          the drawing area.
 * @param interval
 *          the interval.
 */
@Override
protected void drawArcForInterval(final Graphics2D g2, final Rectangle2D meterArea,
        final MeterInterval interval) {

    final double minValue = interval.getRange().getLowerBound();
    final double maxValue = interval.getRange().getUpperBound();
    final Paint outlinePaint = interval.getOutlinePaint();
    final Stroke outlineStroke = interval.getOutlineStroke();
    final Paint backgroundPaint = interval.getBackgroundPaint();

    if (backgroundPaint != null) {
        fillArc(g2, meterArea, minValue, maxValue, backgroundPaint, false);
    }
    if (outlinePaint != null) {
        if (outlineStroke != null) {
            drawArc(g2, meterArea, minValue, maxValue, outlinePaint, outlineStroke);
        }

        final boolean isOutlineInterval = interval.getOutlinePaint() == getDialOutlinePaint();
        drawTick(g2, meterArea, minValue, isOutlineInterval);
        drawTick(g2, meterArea, maxValue, isOutlineInterval);
    }
}

From source file:net.sf.dynamicreports.test.jasper.chart.MeterChartTest.java

private void intervalTest(MeterInterval interval, String label, Color backgroundColor, double rangeLow,
        double rangeHigh) {
    Assert.assertEquals("interval label", label, interval.getLabel());
    Assert.assertEquals("interval background color", backgroundColor, interval.getBackgroundPaint());
    Assert.assertEquals("interval data range low", rangeLow, interval.getRange().getLowerBound());
    Assert.assertEquals("interval data range high", rangeHigh, interval.getRange().getUpperBound());
}

From source file:org.pentaho.platform.uifoundation.chart.DialWidgetDefinition.java

/**
 * Add an interval (MeterInterval) to the dial definition. The interval defines a range and how it should be
 * painted./*ww w . j av a  2 s .com*/
 * <p/>
 * The dial images here have three intervals. The lowest interval has a minimum of 0 and a maximum of 30.
 * <p/>
 * Intervals have a color. In this image the lowest interval color is set to red. <br/>
 * <img src="doc-files/DialWidgetDefinition-5.png">
 * <p/>
 * Intervals have a text color. In this image the lowest interval text color is set to red. This affects the
 * outer rim, the interval value text <br/>
 * <img src="doc-files/DialWidgetDefinition-6.png">
 * 
 * @param interval
 *          A MeterInterval that defines an interval (range) on the dial
 */
public void addInterval(final MeterInterval interval) {
    intervals.add(interval);
    Range range = interval.getRange();
    double min = range.getLowerBound();
    double max = range.getUpperBound();
    if (rangeLimited && (intervals.size() == 1)) {
        setMinimum(min);
        setMaximum(max);
    } else {
        if (min < getMinimum()) {
            setMinimum(min);
        }
        if (max > getMaximum()) {
            setMaximum(max);
        }
    }
}