Java Code Examples for org.jfree.data.Range#getLowerBound()
The following examples show how to use
org.jfree.data.Range#getLowerBound() .
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: GraphingWindow.java From BowlerStudio with GNU General Public License v3.0 | 6 votes |
private void setMovedWindow(double percent) { axis.setAutoRange(false); Range total = xyDataset.getDomainBounds(true); double lower =total.getLowerBound(); double upper =total.getUpperBound(); double loc = (upper -lower)*percent/100; double sLower =loc-(scale.getValue()/2); double sUpper =loc+(scale.getValue()/2); axis.setRange(sLower, sUpper); length.setText(String.valueOf(scale.getValue())); //invalidate(); //repaint(); }
Example 2
Source File: DefaultContourDataset.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Returns the maximum z-value within visible region of plot. * * @param x the x range. * @param y the y range. * * @return The z range. */ public Range getZValueRange(Range x, Range y) { double minX = x.getLowerBound(); double minY = y.getLowerBound(); double maxX = x.getUpperBound(); double maxY = y.getUpperBound(); double zMin = 1.e20; double zMax = -1.e20; for (int k = 0; k < this.zValues.length; k++) { if (this.xValues[k].doubleValue() >= minX && this.xValues[k].doubleValue() <= maxX && this.yValues[k].doubleValue() >= minY && this.yValues[k].doubleValue() <= maxY) { if (this.zValues[k] != null) { zMin = Math.min(zMin, this.zValues[k].doubleValue()); zMax = Math.max(zMax, this.zValues[k].doubleValue()); } } } return new Range(zMin, zMax); }
Example 3
Source File: DefaultContourDataset.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Returns the maximum z-value within visible region of plot. * * @param x the x range. * @param y the y range. * * @return The z range. */ @Override public Range getZValueRange(Range x, Range y) { double minX = x.getLowerBound(); double minY = y.getLowerBound(); double maxX = x.getUpperBound(); double maxY = y.getUpperBound(); double zMin = 1.e20; double zMax = -1.e20; for (int k = 0; k < this.zValues.length; k++) { if (this.xValues[k].doubleValue() >= minX && this.xValues[k].doubleValue() <= maxX && this.yValues[k].doubleValue() >= minY && this.yValues[k].doubleValue() <= maxY) { if (this.zValues[k] != null) { zMin = Math.min(zMin, this.zValues[k].doubleValue()); zMax = Math.max(zMax, this.zValues[k].doubleValue()); } } } return new Range(zMin, zMax); }
Example 4
Source File: XYShapeRenderer.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * * @param dataset the dataset (<code>null</code> permitted). * * @return The range (<code>null</code> if the dataset is <code>null</code> * or empty). */ @Override public Range findRangeBounds(XYDataset dataset) { if (dataset == null) { return null; } Range r = DatasetUtilities.findRangeBounds(dataset, false); if (r == null) { return null; } double offset = 0; // TODO getSeriesShape(n).getBounds().height / 2; return new Range(r.getLowerBound() + offset, r.getUpperBound() + offset); }
Example 5
Source File: XYShapeRenderer.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Returns the range of values the renderer requires to display all the * items from the specified dataset. * * @param dataset the dataset (<code>null</code> permitted). * * @return The range (<code>null</code> if the dataset is <code>null</code> * or empty). */ @Override public Range findRangeBounds(XYDataset dataset) { if (dataset == null) { return null; } Range r = DatasetUtilities.findRangeBounds(dataset, false); if (r == null) { return null; } double offset = 0; // TODO getSeriesShape(n).getBounds().height / 2; return new Range(r.getLowerBound() + offset, r.getUpperBound() + offset); }
Example 6
Source File: TimeSeriesCollection.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * Returns the minimum x-value in the dataset. * * @param includeInterval a flag that determines whether or not the * x-interval is taken into account. * * @return The minimum value. */ public double getDomainLowerBound(boolean includeInterval) { double result = Double.NaN; Range r = getDomainBounds(includeInterval); if (r != null) { result = r.getLowerBound(); } return result; }
Example 7
Source File: TimeTableXYDataset.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Returns the minimum x-value in the dataset. * * @param includeInterval a flag that determines whether or not the * x-interval is taken into account. * * @return The minimum value. */ @Override public double getDomainLowerBound(boolean includeInterval) { double result = Double.NaN; Range r = getDomainBounds(includeInterval); if (r != null) { result = r.getLowerBound(); } return result; }
Example 8
Source File: XYShapeRenderer.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Returns the lower and upper bounds (range) of the x-values in the * specified dataset. * * @param dataset the dataset (<code>null</code> permitted). * * @return The range (<code>null</code> if the dataset is <code>null</code> * or empty). */ @Override public Range findDomainBounds(XYDataset dataset) { if (dataset == null) { return null; } Range r = DatasetUtilities.findDomainBounds(dataset, false); if (r == null) { return null; } double offset = 0; // TODO getSeriesShape(n).getBounds().width / 2; return new Range(r.getLowerBound() + offset, r.getUpperBound() + offset); }
Example 9
Source File: LogAxis.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Slides the axis range by the specified percentage. * * @param percent the percentage. * * @since 1.0.13 */ @Override public void pan(double percent) { Range range = getRange(); double lower = range.getLowerBound(); double upper = range.getUpperBound(); double log1 = calculateLog(lower); double log2 = calculateLog(upper); double length = log2 - log1; double adj = length * percent; log1 = log1 + adj; log2 = log2 + adj; setRange(calculateValueNoINF(log1), calculateValueNoINF(log2)); }
Example 10
Source File: LogAxis.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Estimates the maximum width of the tick labels, assuming the specified * tick unit is used. * <P> * Rather than computing the string bounds of every tick on the axis, we * just look at two values: the lower bound and the upper bound for the * axis. These two values will usually be representative. * * @param g2 the graphics device. * @param unit the tick unit to use for calculation. * * @return The estimated maximum width of the tick labels. * * @since 1.0.7 */ protected double estimateMaximumTickLabelWidth(Graphics2D g2, TickUnit unit) { RectangleInsets tickLabelInsets = getTickLabelInsets(); double result = tickLabelInsets.getLeft() + tickLabelInsets.getRight(); if (isVerticalTickLabels()) { // all tick labels have the same width (equal to the height of the // font)... FontRenderContext frc = g2.getFontRenderContext(); LineMetrics lm = getTickLabelFont().getLineMetrics("0", frc); result += lm.getHeight(); } else { // look at lower and upper bounds... FontMetrics fm = g2.getFontMetrics(getTickLabelFont()); Range range = getRange(); double lower = range.getLowerBound(); double upper = range.getUpperBound(); String lowerStr = ""; String upperStr = ""; NumberFormat formatter = getNumberFormatOverride(); if (formatter != null) { lowerStr = formatter.format(lower); upperStr = formatter.format(upper); } else { lowerStr = unit.valueToString(lower); upperStr = unit.valueToString(upper); } double w1 = fm.stringWidth(lowerStr); double w2 = fm.stringWidth(upperStr); result += Math.max(w1, w2); } return result; }
Example 11
Source File: LogAxis.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Slides the axis range by the specified percentage. * * @param percent the percentage. * * @since 1.0.13 */ @Override public void pan(double percent) { Range range = getRange(); double lower = range.getLowerBound(); double upper = range.getUpperBound(); double log1 = calculateLog(lower); double log2 = calculateLog(upper); double length = log2 - log1; double adj = length * percent; log1 = log1 + adj; log2 = log2 + adj; setRange(calculateValueNoINF(log1), calculateValueNoINF(log2)); }
Example 12
Source File: ValueAxis.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Slides the axis range by the specified percentage. * * @param percent the percentage. * * @since 1.0.13 */ public void pan(double percent) { Range range = getRange(); double length = range.getLength(); double adj = length * percent; double lower = range.getLowerBound() + adj; double upper = range.getUpperBound() + adj; setRange(lower, upper); }
Example 13
Source File: NumberAxis.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Converts a coordinate in Java2D space to the corresponding data value, * assuming that the axis runs along one edge of the specified dataArea. * * @param java2DValue the coordinate in Java2D space. * @param area the area in which the data is plotted. * @param edge the location. * * @return The data value. * * @see #valueToJava2D(double, Rectangle2D, RectangleEdge) */ @Override public double java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = range.getUpperBound(); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { min = area.getMaxY(); max = area.getY(); } if (isInverted()) { return axisMax - (java2DValue - min) / (max - min) * (axisMax - axisMin); } else { return axisMin + (java2DValue - min) / (max - min) * (axisMax - axisMin); } }
Example 14
Source File: NumberAxis.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Converts a data value to a coordinate in Java2D space, assuming that the * axis runs along one edge of the specified dataArea. * <p> * Note that it is possible for the coordinate to fall outside the plotArea. * * @param value the data value. * @param area the area for plotting the data. * @param edge the axis location. * * @return The Java2D coordinate. * * @see #java2DToValue(double, Rectangle2D, RectangleEdge) */ @Override public double valueToJava2D(double value, Rectangle2D area, RectangleEdge edge) { Range range = getRange(); double axisMin = range.getLowerBound(); double axisMax = range.getUpperBound(); double min = 0.0; double max = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { min = area.getX(); max = area.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { max = area.getMinY(); min = area.getMaxY(); } if (isInverted()) { return max - ((value - axisMin) / (axisMax - axisMin)) * (max - min); } else { return min + ((value - axisMin) / (axisMax - axisMin)) * (max - min); } }
Example 15
Source File: TimeSeriesCollection.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Returns the minimum x-value in the dataset. * * @param includeInterval a flag that determines whether or not the * x-interval is taken into account. * * @return The minimum value. */ @Override public double getDomainLowerBound(boolean includeInterval) { double result = Double.NaN; Range r = getDomainBounds(includeInterval); if (r != null) { result = r.getLowerBound(); } return result; }
Example 16
Source File: CyclicNumberAxis.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * Translates a value from data space to Java 2D space. * * @param value the data value. * @param dataArea the data area. * @param edge the edge. * * @return The Java 2D value. */ @Override public double valueToJava2D(double value, Rectangle2D dataArea, RectangleEdge edge) { Range range = getRange(); double vmin = range.getLowerBound(); double vmax = range.getUpperBound(); double vp = getCycleBound(); if ((value < vmin) || (value > vmax)) { return Double.NaN; } double jmin = 0.0; double jmax = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { jmin = dataArea.getMinX(); jmax = dataArea.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { jmax = dataArea.getMinY(); jmin = dataArea.getMaxY(); } if (isInverted()) { if (value == vp) { return this.boundMappedToLastCycle ? jmin : jmax; } else if (value > vp) { return jmax - (value - vp) * (jmax - jmin) / this.period; } else { return jmin + (vp - value) * (jmax - jmin) / this.period; } } else { if (value == vp) { return this.boundMappedToLastCycle ? jmax : jmin; } else if (value >= vp) { return jmin + (value - vp) * (jmax - jmin) / this.period; } else { return jmax - (vp - value) * (jmax - jmin) / this.period; } } }
Example 17
Source File: NumberAxis.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Rescales the axis to ensure that all data is visible. */ @Override protected void autoAdjustRange() { Plot plot = getPlot(); if (plot == null) { return; // no plot, no data } if (plot instanceof ValueAxisPlot) { ValueAxisPlot vap = (ValueAxisPlot) plot; Range r = vap.getDataRange(this); if (r == null) { r = getDefaultAutoRange(); } double upper = r.getUpperBound(); double lower = r.getLowerBound(); if (this.rangeType == RangeType.POSITIVE) { lower = Math.max(0.0, lower); upper = Math.max(0.0, upper); } else if (this.rangeType == RangeType.NEGATIVE) { lower = Math.min(0.0, lower); upper = Math.min(0.0, upper); } if (getAutoRangeIncludesZero()) { lower = Math.min(lower, 0.0); upper = Math.max(upper, 0.0); } double range = upper - lower; // if fixed auto range, then derive lower bound... double fixedAutoRange = getFixedAutoRange(); if (fixedAutoRange > 0.0) { lower = upper - fixedAutoRange; } else { // ensure the autorange is at least <minRange> in size... double minRange = getAutoRangeMinimumSize(); if (range < minRange) { double expand = (minRange - range) / 2; upper = upper + expand; lower = lower - expand; if (lower == upper) { // see bug report 1549218 double adjust = Math.abs(lower) / 10.0; lower = lower - adjust; upper = upper + adjust; } if (this.rangeType == RangeType.POSITIVE) { if (lower < 0.0) { upper = upper - lower; lower = 0.0; } } else if (this.rangeType == RangeType.NEGATIVE) { if (upper > 0.0) { lower = lower - upper; upper = 0.0; } } } if (getAutoRangeStickyZero()) { if (upper <= 0.0) { upper = Math.min(0.0, upper + getUpperMargin() * range); } else { upper = upper + getUpperMargin() * range; } if (lower >= 0.0) { lower = Math.max(0.0, lower - getLowerMargin() * range); } else { lower = lower - getLowerMargin() * range; } } else { upper = upper + getUpperMargin() * range; lower = lower - getLowerMargin() * range; } } setRange(new Range(lower, upper), false, false); } }
Example 18
Source File: CyclicNumberAxis.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Translates a value from data space to Java 2D space. * * @param value the data value. * @param dataArea the data area. * @param edge the edge. * * @return The Java 2D value. */ @Override public double valueToJava2D(double value, Rectangle2D dataArea, RectangleEdge edge) { Range range = getRange(); double vmin = range.getLowerBound(); double vmax = range.getUpperBound(); double vp = getCycleBound(); if ((value < vmin) || (value > vmax)) { return Double.NaN; } double jmin = 0.0; double jmax = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { jmin = dataArea.getMinX(); jmax = dataArea.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { jmax = dataArea.getMinY(); jmin = dataArea.getMaxY(); } if (isInverted()) { if (value == vp) { return this.boundMappedToLastCycle ? jmin : jmax; } else if (value > vp) { return jmax - (value - vp) * (jmax - jmin) / this.period; } else { return jmin + (vp - value) * (jmax - jmin) / this.period; } } else { if (value == vp) { return this.boundMappedToLastCycle ? jmax : jmin; } else if (value >= vp) { return jmin + (value - vp) * (jmax - jmin) / this.period; } else { return jmax - (vp - value) * (jmax - jmin) / this.period; } } }
Example 19
Source File: CyclicNumberAxis.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Translates a value from data space to Java 2D space. * * @param value the data value. * @param dataArea the data area. * @param edge the edge. * * @return The Java 2D value. */ @Override public double valueToJava2D(double value, Rectangle2D dataArea, RectangleEdge edge) { Range range = getRange(); double vmin = range.getLowerBound(); double vmax = range.getUpperBound(); double vp = getCycleBound(); if ((value < vmin) || (value > vmax)) { return Double.NaN; } double jmin = 0.0; double jmax = 0.0; if (RectangleEdge.isTopOrBottom(edge)) { jmin = dataArea.getMinX(); jmax = dataArea.getMaxX(); } else if (RectangleEdge.isLeftOrRight(edge)) { jmax = dataArea.getMinY(); jmin = dataArea.getMaxY(); } if (isInverted()) { if (value == vp) { return this.boundMappedToLastCycle ? jmin : jmax; } else if (value > vp) { return jmax - (value - vp) * (jmax - jmin) / this.period; } else { return jmin + (vp - value) * (jmax - jmin) / this.period; } } else { if (value == vp) { return this.boundMappedToLastCycle ? jmax : jmin; } else if (value >= vp) { return jmin + (value - vp) * (jmax - jmin) / this.period; } else { return jmax - (vp - value) * (jmax - jmin) / this.period; } } }
Example 20
Source File: CyclicNumberAxis.java From openstock with GNU General Public License v3.0 | 3 votes |
/** * Sets a new axis range. The period is extended to fit the range size, if * necessary. * * @param range the range. * @param turnOffAutoRange switch off the auto range. * @param notify notify? * * @see org.jfree.chart.axis.ValueAxis#setRange(Range, boolean, boolean) */ @Override public void setRange(Range range, boolean turnOffAutoRange, boolean notify) { double size = range.getUpperBound() - range.getLowerBound(); if (size > this.period) { this.period = size; } super.setRange(range, turnOffAutoRange, notify); }