當前位置: 首頁>>代碼示例>>Java>>正文


Java Range.getUpperBound方法代碼示例

本文整理匯總了Java中org.jfree.data.Range.getUpperBound方法的典型用法代碼示例。如果您正苦於以下問題:Java Range.getUpperBound方法的具體用法?Java Range.getUpperBound怎麽用?Java Range.getUpperBound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.data.Range的用法示例。


在下文中一共展示了Range.getUpperBound方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: valueToJava2D

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * 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.
 */
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);
    }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:37,代碼來源:NumberAxis.java

示例2: java2DToValue

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * 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.
 */
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);
    }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:35,代碼來源:NumberAxis.java

示例3: getZValueRange

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * 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);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:32,代碼來源:DefaultContourDataset.java

示例4: getDomainUpperBound

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * Returns the maximum x-value in the dataset.
 *
 * @param includeInterval  a flag that determines whether or not the
 *                         x-interval is taken into account.
 * 
 * @return The maximum value.
 */
public double getDomainUpperBound(boolean includeInterval) {
    double result = Double.NaN;
    Range r = getDomainBounds(includeInterval);
    if (r != null) {
        result = r.getUpperBound();
    }
    return result;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:17,代碼來源:TimePeriodValuesCollection.java

示例5: estimateMaximumTickLabelWidth

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * 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.
 */
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;

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:52,代碼來源:NumberAxis.java

示例6: findDomainBounds

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * 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).
 */
public Range findDomainBounds(XYDataset dataset) {
    if (dataset != null) {
        Range r = DatasetUtilities.findDomainBounds(dataset, false);
        return new Range(r.getLowerBound() + this.xOffset, 
                r.getUpperBound() + this.blockWidth + this.xOffset);
    }
    else {
        return null;
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:20,代碼來源:XYBlockRenderer.java

示例7: trimToContentWidth

import org.jfree.data.Range; //導入方法依賴的package包/類
private Range trimToContentWidth(Range r) {
    if (r == null) {
        return null;   
    }
    double lowerBound = 0.0;
    double upperBound = Double.POSITIVE_INFINITY;
    if (r.getLowerBound() > 0.0) {
        lowerBound = trimToContentWidth(r.getLowerBound());   
    }
    if (r.getUpperBound() < Double.POSITIVE_INFINITY) {
        upperBound = trimToContentWidth(r.getUpperBound());
    }
    return new Range(lowerBound, upperBound);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:15,代碼來源:AbstractBlock.java

示例8: trimToContentHeight

import org.jfree.data.Range; //導入方法依賴的package包/類
private Range trimToContentHeight(Range r) {
    if (r == null) {
        return null;   
    }
    double lowerBound = 0.0;
    double upperBound = Double.POSITIVE_INFINITY;
    if (r.getLowerBound() > 0.0) {
        lowerBound = trimToContentHeight(r.getLowerBound());   
    }
    if (r.getUpperBound() < Double.POSITIVE_INFINITY) {
        upperBound = trimToContentHeight(r.getUpperBound());
    }
    return new Range(lowerBound, upperBound);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:15,代碼來源:AbstractBlock.java

示例9: toRangeWidth

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * Returns a constraint that matches this one on the height attributes,
 * but has a range width constraint.
 * 
 * @param range  the width range (<code>null</code> not permitted).
 * 
 * @return A new constraint.
 */
public RectangleConstraint toRangeWidth(Range range) {
    if (range == null) {
        throw new IllegalArgumentException("Null 'range' argument.");   
    }
    return new RectangleConstraint(
        range.getUpperBound(), range, LengthConstraintType.RANGE,
        this.height, this.heightRange, this.heightConstraintType
    );
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:18,代碼來源:RectangleConstraint.java

示例10: toRangeHeight

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * Returns a constraint that matches this one on the width attributes,
 * but has a range height constraint.
 * 
 * @param range  the height range (<code>null</code> not permitted).
 * 
 * @return A new constraint.
 */
public RectangleConstraint toRangeHeight(Range range) {
    if (range == null) {
        throw new IllegalArgumentException("Null 'range' argument.");   
    }
    return new RectangleConstraint(
        this.width, this.widthRange, this.widthConstraintType,
        range.getUpperBound(), range, LengthConstraintType.RANGE
    );
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:18,代碼來源:RectangleConstraint.java

示例11: valueToJava2D

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * 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)
 */
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);
    }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:42,代碼來源:NumberAxis.java

示例12: java2DToValue

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * 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)
 */
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);
    }

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:40,代碼來源:NumberAxis.java

示例13: setPlotConfiguration

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * Sets the current {@link PlotConfiguration} for this dialog.
 * 
 * @param plotConfig
 */
private void setPlotConfiguration(PlotConfiguration plotConfig) {
	if (plotConfig == null) {
		throw new IllegalArgumentException("plotConfig must not be null!");
	}

	Vector<RangeAxisConfig> rangeConfigsVector = new Vector<RangeAxisConfig>();
	String selectedItem = String.valueOf(rangeAxisSelectionCombobox.getSelectedItem());
	for (RangeAxisConfig config : plotConfig.getRangeAxisConfigs()) {
		rangeConfigsVector.add(config);
	}
	rangeAxisSelectionCombobox.setModel(new DefaultComboBoxModel(rangeConfigsVector));

	// reselect the previously selected RangeAxisConfig (if it is still there)
	if (selectedItem != null) {
		for (int i = 0; i < rangeAxisSelectionCombobox.getItemCount(); i++) {
			if (String.valueOf(rangeAxisSelectionCombobox.getItemAt(i)).equals(selectedItem)) {
				rangeAxisSelectionCombobox.setSelectedIndex(i);
				break;
			}
		}
	}

	// fill in values of current chart
	Plot plot = engine.getChartPanel().getChart().getPlot();
	double domainLowerBound = 0;
	double domainUpperBound = 0;
	boolean disableDomainZoom = false;
	NumericalValueRange effectiveRange = engine.getPlotInstance().getPlotData().getDomainConfigManagerData()
			.getEffectiveRange();
	if (plot instanceof XYPlot) {
		ValueAxis domainAxis = ((XYPlot) plot).getDomainAxis();
		if (domainAxis != null) {
			Range range = domainAxis.getRange();
			domainLowerBound = range.getLowerBound();
			domainUpperBound = range.getUpperBound();
		} else {
			if (effectiveRange != null) {
				domainLowerBound = effectiveRange.getLowerBound();
				domainUpperBound = effectiveRange.getUpperBound();
			} else {
				disableDomainZoom = true;
			}
		}
	} else {
		if (effectiveRange != null) {
			domainLowerBound = effectiveRange.getLowerBound();
			domainUpperBound = effectiveRange.getUpperBound();
		} else {
			disableDomainZoom = true;
		}
	}
	domainRangeLowerBoundField.setText(String.valueOf(domainLowerBound));
	domainRangeUpperBoundField.setText(String.valueOf(domainUpperBound));

	// happens on nominal domain axis
	domainRangeLowerBoundField.setEnabled(!disableDomainZoom);
	domainRangeUpperBoundField.setEnabled(!disableDomainZoom);

	updateValueRange();
	updateColorValues();
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:67,代碼來源:ManageZoomDialog.java

示例14: _updateHighLowJLabels

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * Calculate and update high low value labels, according to current displayed
 * time range. This is a time consuming method, and shall be called by
 * user thread.
 */
private void _updateHighLowJLabels() {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            ChartJDialog.this.jLabel2.setText("");
            ChartJDialog.this.jLabel4.setText("");
        }
    });

    final ValueAxis valueAxis = this.getPlot().getDomainAxis();
    final Range range = valueAxis.getRange();
    final long lowerBound = (long)range.getLowerBound();
    final long upperBound = (long)range.getUpperBound();
    final DefaultHighLowDataset defaultHighLowDataset = (DefaultHighLowDataset)this.priceOHLCDataset;

    // Perform binary search, to located day in price time series, which
    // is equal or lesser than upperBound.
    int low = 0;
    int high = defaultHighLowDataset.getItemCount(0) - 1;
    long best_dist = Long.MAX_VALUE;
    int best_mid = -1;
    while (low <= high) {
        int mid = (low + high) >>> 1;
        long v = defaultHighLowDataset.getXDate(0, mid).getTime();

        if (v > upperBound) {
            high = mid - 1;
        }
        else if (v < upperBound) {
            low = mid + 1;
            long dist = upperBound - v;
            if (dist < best_dist) {
                best_dist = dist;
                best_mid = mid;
            }
        }
        else {
            best_dist = 0;
            best_mid = mid;
            break;
        }
    }

    if (best_mid < 0) {
        return;
    }

    double high_last_price = Double.NEGATIVE_INFINITY;
    double low_last_price = Double.MAX_VALUE;
    for (int i = best_mid; i >= 0; i--) {
        final long time = defaultHighLowDataset.getXDate(0, i).getTime();
        if (time < lowerBound) {
            break;
        }
        if (high_last_price < defaultHighLowDataset.getHighValue(0, i)) {
            high_last_price = defaultHighLowDataset.getHighValue(0, i);
        }
        if (low_last_price > defaultHighLowDataset.getLowValue(0, i)) {
            low_last_price = defaultHighLowDataset.getLowValue(0, i);
        }
    }

    final double h = high_last_price;
    final double l = low_last_price;
    if (high_last_price >= low_last_price) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                ChartJDialog.this.jLabel2.setText(stockPriceDecimalFormat(h));
                ChartJDialog.this.jLabel4.setText(stockPriceDecimalFormat(l));
            }
        });
    }
}
 
開發者ID:lead4good,項目名稱:open-java-trade-manager,代碼行數:80,代碼來源:ChartJDialog.java

示例15: valueToJava2D

import org.jfree.data.Range; //導入方法依賴的package包/類
/**
 * 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.
 */
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;
        }
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:57,代碼來源:CyclicNumberAxis.java


注:本文中的org.jfree.data.Range.getUpperBound方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。