List of usage examples for org.jfree.data Range Range
public Range(double lower, double upper)
From source file:com.sciaps.view.PlotConfigPanel.java
private Range createDomainRange(final int action) { double lowerBound = domainAxis_.getRange().getLowerBound(); double upperBound = domainAxis_.getRange().getUpperBound(); double shiftValue = Math.ceil((upperBound - lowerBound) * .05); if (action == LEFT) { return (new Range(lowerBound - shiftValue, upperBound - shiftValue)); } else if (action == RIGHT) { return (new Range(lowerBound + shiftValue, upperBound + shiftValue)); }/*from w w w . j a v a2s. com*/ return null; }
From source file:com.sciaps.view.PlotConfigPanel.java
private Range createRangeRange(final int action) { double lowerBound = rangeAxis_.getRange().getLowerBound(); double upperBound = rangeAxis_.getRange().getUpperBound(); double shiftValue = (upperBound - lowerBound) * .05; if (action == DOWN) { return (new Range(lowerBound - shiftValue, upperBound - shiftValue)); } else if (action == UP) { return (new Range(lowerBound + shiftValue, upperBound + shiftValue)); }//www . j a v a 2 s .c om return null; }
From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java
/** * Move a chart by a percentage x-offset if xoffset is <0 the shift will be negativ (xoffset>0 * results in a positive shift)/* w w w . j av a 2s . co m*/ * * @param myChart * @param xoffset in percent * @param autoRangeY if true the range (Y) axis auto bounds will be restored */ public static void offsetDomainAxis(ChartViewer myChart, double xoffset, boolean autoRangeY) { XYPlot plot = (XYPlot) myChart.getChart().getPlot(); ValueAxis domainAxis = plot.getDomainAxis(); // apply offset on x double distance = (domainAxis.getUpperBound() - domainAxis.getLowerBound()) * xoffset; Range range = new Range(domainAxis.getLowerBound() + distance, domainAxis.getUpperBound() + distance); setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY); }
From source file:utilesChart.util.TimeSeriesCollection.java
/** * Returns the range of the values in this dataset's domain. * * @param includeInterval a flag that determines whether or not the * x-interval is taken into account. * * @return The range./*from w w w . j av a 2s. c o m*/ */ public Range getDomainBounds(boolean includeInterval) { Range result = null; Iterator iterator = this.data.iterator(); while (iterator.hasNext()) { TimeSeries series = (TimeSeries) iterator.next(); int count = series.getItemCount(); if (count > 0) { RegularTimePeriod start = series.getTimePeriod(0); RegularTimePeriod end = series.getTimePeriod(count - 1); Range temp; if (!includeInterval) { temp = new Range(getX(start), getX(end)); } else { temp = new Range(start.getFirstMillisecond(this.workingCalendar), end.getLastMillisecond(this.workingCalendar)); } result = Range.combine(result, temp); } } return result; }
From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java
/** * Apply an absolute offset to domain (x) axis and move it * /*from w ww . j av a2s . c o m*/ * @param myChart * @param xoffset * @param autoRangeY */ public static void offsetDomainAxisAbsolute(ChartViewer myChart, double xoffset, boolean autoRangeY) { XYPlot plot = (XYPlot) myChart.getChart().getPlot(); ValueAxis domainAxis = plot.getDomainAxis(); // apply offset on x Range range = new Range(domainAxis.getLowerBound() + xoffset, domainAxis.getUpperBound() + xoffset); setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY); }
From source file:org.jfree.data.xy.XYSeriesCollection.java
/** * Returns the range of the values in this dataset's range. * * @param includeInterval ignored./*from w w w . j av a 2 s . com*/ * * @return The range (or <code>null</code> if the dataset contains no * values). */ @Override public Range getRangeBounds(boolean includeInterval) { double lower = Double.POSITIVE_INFINITY; double upper = Double.NEGATIVE_INFINITY; int seriesCount = getSeriesCount(); for (int s = 0; s < seriesCount; s++) { XYSeries series = getSeries(s); double minY = series.getMinY(); if (!Double.isNaN(minY)) { lower = Math.min(lower, minY); } double maxY = series.getMaxY(); if (!Double.isNaN(maxY)) { upper = Math.max(upper, maxY); } } if (lower > upper) { return null; } else { return new Range(lower, upper); } }
From source file:net.sf.mzmine.chartbasics.ChartLogics.java
/** * Move a chart by a percentage x-offset if xoffset is <0 the shift will be negativ (xoffset>0 * results in a positive shift)//from w w w .j a v a2 s . c o m * * @param myChart * @param xoffset in percent * @param autoRangeY if true the range (Y) axis auto bounds will be restored */ public static void offsetDomainAxis(ChartPanel myChart, double xoffset, boolean autoRangeY) { XYPlot plot = (XYPlot) myChart.getChart().getPlot(); ValueAxis domainAxis = plot.getDomainAxis(); // apply offset on x double distance = (domainAxis.getUpperBound() - domainAxis.getLowerBound()) * xoffset; Range range = new Range(domainAxis.getLowerBound() + distance, domainAxis.getUpperBound() + distance); setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY); }
From source file:edu.dlnu.liuwenpeng.Time.TimeSeriesCollection.java
/** * Returns the range of the values in this dataset's domain. * //from ww w . ja va 2s .c om * @param includeInterval a flag that determines whether or not the * x-interval is taken into account. * * @return The range. */ public Range getDomainBounds(boolean includeInterval) { Range result = null; Iterator iterator = this.data.iterator(); while (iterator.hasNext()) { TimeSeries series = (TimeSeries) iterator.next(); int count = series.getItemCount(); if (count > 0) { RegularTimePeriod start = series.getTimePeriod(0); RegularTimePeriod end = series.getTimePeriod(count - 1); Range temp; //if (!includeInterval) { temp = new Range(getX(start), getX(end)); //System.out.println("here"); // } /* else { temp = new Range( start.getFirstMillisecond(this.workingCalendar), end.getLastMillisecond(this.workingCalendar)); } */ result = Range.combine(result, temp); } } return result; }
From source file:net.sf.mzmine.chartbasics.ChartLogics.java
/** * Apply an absolute offset to domain (x) axis and move it * /*from w ww .j a v a 2 s .co m*/ * @param myChart * @param xoffset * @param autoRangeY */ public static void offsetDomainAxisAbsolute(ChartPanel myChart, double xoffset, boolean autoRangeY) { XYPlot plot = (XYPlot) myChart.getChart().getPlot(); ValueAxis domainAxis = plot.getDomainAxis(); // apply offset on x Range range = new Range(domainAxis.getLowerBound() + xoffset, domainAxis.getUpperBound() + xoffset); setZoomDomainAxis(myChart, keepRangeWithinAutoBounds(domainAxis, range), autoRangeY); }
From source file:utilesChart.util.TimeSeriesCollection.java
/** * Returns the bounds of the domain values for the specified series. * * @param visibleSeriesKeys a list of keys for the visible series. * @param includeInterval include the x-interval? * * @return A range./*from w w w .ja va2 s .com*/ * * @since 1.0.13 */ public Range getDomainBounds(List visibleSeriesKeys, boolean includeInterval) { Range result = null; Iterator iterator = visibleSeriesKeys.iterator(); while (iterator.hasNext()) { Comparable seriesKey = (Comparable) iterator.next(); TimeSeries series = getSeries(seriesKey); int count = series.getItemCount(); if (count > 0) { RegularTimePeriod start = series.getTimePeriod(0); RegularTimePeriod end = series.getTimePeriod(count - 1); Range temp; if (!includeInterval) { temp = new Range(getX(start), getX(end)); } else { temp = new Range(start.getFirstMillisecond(this.workingCalendar), end.getLastMillisecond(this.workingCalendar)); } result = Range.combine(result, temp); } } return result; }