List of usage examples for org.jfree.data Range getUpperBound
public double getUpperBound()
From source file:com.hazelcast.monitor.server.InstanceChartGenerator.java
static void increaseRange(NumberAxis axis) { Range range = axis.getRange(); double lower = range.getLowerBound(); double upper = range.getUpperBound(); double diff = upper - lower; axis.setRange(lower - diff * 0.3, upper + diff * 0.3); }
From source file:org.jfree.data.Range.java
/** * Returns a range that includes all the values in the specified * <code>range</code> AND the specified <code>value</code>. * * @param range the range (<code>null</code> permitted). * @param value the value that must be included. * * @return A range.//from ww w . j av a2s . c om * * @since 1.0.1 */ public static Range expandToInclude(Range range, double value) { if (range == null) { return new Range(value, value); } if (value < range.getLowerBound()) { return new Range(value, range.getUpperBound()); } else if (value > range.getUpperBound()) { return new Range(range.getLowerBound(), value); } else { return range; } }
From source file:org.jfree.data.Range.java
/** * Shifts the range by the specified amount. * * @param base the base range (<code>null</code> not permitted). * @param delta the shift amount./*w w w .ja v a 2 s . c om*/ * @param allowZeroCrossing a flag that determines whether or not the * bounds of the range are allowed to cross * zero after adjustment. * * @return A new range. */ public static Range shift(Range base, double delta, boolean allowZeroCrossing) { ParamChecks.nullNotPermitted(base, "base"); if (allowZeroCrossing) { return new Range(base.getLowerBound() + delta, base.getUpperBound() + delta); } else { return new Range(shiftWithNoZeroCrossing(base.getLowerBound(), delta), shiftWithNoZeroCrossing(base.getUpperBound(), delta)); } }
From source file:org.gumtree.vis.mask.ChartMaskingUtilities.java
public static double translateChartY(double chartY, Rectangle2D imageArea, JFreeChart chart) { XYPlot plot = chart.getXYPlot();/*from ww w. j av a 2 s. c o m*/ boolean isRangeInverted = plot.getRangeAxis().isInverted(); Range rangeSection = plot.getRangeAxis().getRange(); if (!isRangeInverted) { return imageArea.getMinY() + (rangeSection.getUpperBound() - chartY) / rangeSection.getLength() * imageArea.getHeight(); } else { return imageArea.getMinY() + (chartY - rangeSection.getLowerBound()) / rangeSection.getLength() * imageArea.getHeight(); } }
From source file:org.jfree.data.Range.java
/** * Creates a new range by adding margins to an existing range. * * @param range the range (<code>null</code> not permitted). * @param lowerMargin the lower margin (expressed as a percentage of the * range length).//from w w w . j a v a2s. c o m * @param upperMargin the upper margin (expressed as a percentage of the * range length). * * @return The expanded range. */ public static Range expand(Range range, double lowerMargin, double upperMargin) { ParamChecks.nullNotPermitted(range, "range"); double length = range.getLength(); double lower = range.getLowerBound() - length * lowerMargin; double upper = range.getUpperBound() + length * upperMargin; if (lower > upper) { lower = lower / 2.0 + upper / 2.0; upper = lower; } return new Range(lower, upper); }
From source file:org.jfree.data.Range.java
/** * Scales the range by the specified factor. * * @param base the base range (<code>null</code> not permitted). * @param factor the scaling factor (must be non-negative). * * @return A new range.//from ww w .java2s . com * * @since 1.0.9 */ public static Range scale(Range base, double factor) { ParamChecks.nullNotPermitted(base, "base"); if (factor < 0) { throw new IllegalArgumentException("Negative 'factor' argument."); } return new Range(base.getLowerBound() * factor, base.getUpperBound() * factor); }
From source file:net.sf.mzmine.chartbasics.HistogramChartFactory.java
/** * Converts from double array to histogram array * //from w w w.ja va 2s . co m * @param data * @param binwidth * @return A histogram array with length = datawidth/binwidth +1 (datawidth = max-min) */ public static XYSeries createHistoSeries(double[] data, double binwidth) { Range r = getBounds(data); return createHistoSeries(data, binwidth, r.getLowerBound(), r.getUpperBound(), null); }
From source file:net.sf.mzmine.chartbasics.HistogramChartFactory.java
public static JFreeChart createHistogram(double[] data, String yAxisLabel) { Range range = getBounds(data); return createHistogram(data, yAxisLabel, range.getLowerBound(), range.getUpperBound()); }
From source file:org.jfree.data.Range.java
/** * Creates a new range by combining two existing ranges. * <P>//w w w . j av a 2s .com * Note that: * <ul> * <li>either range can be <code>null</code>, in which case the other * range is returned;</li> * <li>if both ranges are <code>null</code> the return value is * <code>null</code>.</li> * </ul> * * @param range1 the first range (<code>null</code> permitted). * @param range2 the second range (<code>null</code> permitted). * * @return A new range (possibly <code>null</code>). */ public static Range combine(Range range1, Range range2) { if (range1 == null) { return range2; } if (range2 == null) { return range1; } double l = Math.min(range1.getLowerBound(), range2.getLowerBound()); double u = Math.max(range1.getUpperBound(), range2.getUpperBound()); return new Range(l, u); }
From source file:net.sf.mzmine.chartbasics.HistogramChartFactory.java
public static JFreeChart createHistogram(double[] data, double binwidth, String yAxisLabel) { Range r = getBounds(data); return createHistogram(data, binwidth, yAxisLabel, r.getLowerBound(), r.getUpperBound(), null); }