List of usage examples for org.jfree.data Range getLowerBound
public double getLowerBound()
From source file:org.griphyn.vdl.karajan.monitor.monitors.swing.GraphPanel.java
private void updateMaxRange() { ValueAxis x = chart.getXYPlot().getDomainAxis(); if (maxRange == 0) { x.setAutoRange(true);/*from w w w . jav a 2 s . c o m*/ } else { Range dr = chart.getXYPlot().getDataRange(x); x.setRange(Math.max(dr.getLowerBound(), dr.getUpperBound() - maxRange * 60 * 1000), dr.getUpperBound()); } }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakAnnotationCalibrationPanel.java
public void onZoomNone() { if (!isChartEmpty()) { Range mz_range = theDocument.getMZRange(); if (mz_range.getLength() == 0.) mz_range = new Range(mz_range.getLowerBound() - 10, mz_range.getLowerBound() + 10); thePlot.getDomainAxis().setRange(mz_range); if (accuracy_unit.equals("da")) { Range acc_range = theDocument.getAccuracyRange(current_ind); if (acc_range.getLength() == 0.) acc_range = new Range(acc_range.getLowerBound() - 0.1, acc_range.getLowerBound() + 0.1); thePlot.getRangeAxis().setRange(acc_range); } else {//w w w . j a v a 2 s .c om Range acc_range = theDocument.getAccuracyRangePPM(current_ind); if (acc_range.getLength() == 0.) acc_range = new Range(acc_range.getLowerBound() - 100, acc_range.getLowerBound() + 100); thePlot.getRangeAxis().setRange(acc_range); } } else { thePlot.getDomainAxis().setRange(new Range(0., 1.)); if (accuracy_unit.equals("da")) thePlot.getRangeAxis().setRange(new Range(-1., 1.)); else thePlot.getRangeAxis().setRange(new Range(-1000., 1000.)); } }
From source file:de.bund.bfr.knime.nls.chart.ChartCreator.java
public ChartCreator(Map<String, Plotable> plotables, Map<String, String> legend) { this.plotables = plotables; this.legend = legend; colors = new LinkedHashMap<>(); shapes = new LinkedHashMap<>(); chartPanel = new ChartPanel(new JFreeChart(new XYPlot())) { private static final long serialVersionUID = 1L; @Override/*from ww w. j av a 2 s. c o m*/ public void mouseReleased(MouseEvent e) { ValueAxis domainAxis = ((XYPlot) chartPanel.getChart().getPlot()).getDomainAxis(); ValueAxis rangeAxis = ((XYPlot) chartPanel.getChart().getPlot()).getRangeAxis(); Range xRange1 = domainAxis.getRange(); Range yRange1 = rangeAxis.getRange(); super.mouseReleased(e); Range xRange2 = domainAxis.getRange(); Range yRange2 = rangeAxis.getRange(); if (!xRange1.equals(xRange2) || !yRange1.equals(yRange2)) { minX = xRange2.getLowerBound(); maxX = xRange2.getUpperBound(); minY = yRange2.getLowerBound(); maxY = yRange2.getUpperBound(); fireZoomChanged(); } } }; chartPanel.getPopupMenu().removeAll(); setLayout(new BorderLayout()); add(chartPanel, BorderLayout.CENTER); }
From source file:edu.dlnu.liuwenpeng.Time.TimeSeriesCollection.java
/** * Returns the minimum x-value in the dataset. * /* w ww. j a v a2 s .c o m*/ * @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; }
From source file:org.jfree.experimental.chart.axis.LogAxis.java
/** * Adjusts the axis range to match the data range that the axis is * required to display.// w w w. j a v a2 s. c om */ 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(); double range = upper - lower; // if fixed auto range, then derive lower bound... double fixedAutoRange = getFixedAutoRange(); if (fixedAutoRange > 0.0) { lower = Math.max(upper - fixedAutoRange, this.smallestValue); } 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; } // apply the margins - these should apply to the exponent range // upper = upper + getUpperMargin() * range; // lower = lower - getLowerMargin() * range; } setRange(new Range(lower, upper), false, false); } }
From source file:org.jfree.data.xy.IntervalXYDelegate.java
/** * Returns the range of the values in the dataset's domain, including * or excluding the interval around each x-value as specified. * * @param includeInterval a flag that determines whether or not the * x-interval should be taken into account. * * @return The range./*ww w. j a v a 2 s.com*/ */ @Override public Range getDomainBounds(boolean includeInterval) { // first get the range without the interval, then expand it for the // interval width Range range = DatasetUtilities.findDomainBounds(this.dataset, false); if (includeInterval && range != null) { double lowerAdj = getIntervalWidth() * getIntervalPositionFactor(); double upperAdj = getIntervalWidth() - lowerAdj; range = new Range(range.getLowerBound() - lowerAdj, range.getUpperBound() + upperAdj); } return range; }
From source file:de.unibayreuth.bayeos.goat.panels.timeseries.JPanelChart.java
/** * used for zooming//from ww w .j a v a 2 s.co m * * @param axis the axis. * @param range the range. * @param zoomFactor the zoom factor. * @param anchorValue the anchor value. */ private void adjustRange(ValueAxis axis, Range range, double zoomFactor, double anchorValue) { if (axis == null || range == null) { return; } double rangeMinVal = range.getLowerBound() - range.getLength() * axis.getLowerMargin(); double rangeMaxVal = range.getUpperBound() + range.getLength() * axis.getUpperMargin(); double halfLength = axis.getRange().getLength() * zoomFactor / 2; double zoomedMinVal = anchorValue - halfLength; double zoomedMaxVal = anchorValue + halfLength; double adjMinVal = zoomedMinVal; if (zoomedMinVal < rangeMinVal) { adjMinVal = rangeMinVal; zoomedMaxVal += rangeMinVal - zoomedMinVal; } double adjMaxVal = zoomedMaxVal; if (zoomedMaxVal > rangeMaxVal) { adjMaxVal = rangeMaxVal; zoomedMinVal -= zoomedMaxVal - rangeMaxVal; adjMinVal = Math.max(zoomedMinVal, rangeMinVal); } Range adjusted = new Range(adjMinVal, adjMaxVal); axis.setRange(adjusted); }
From source file:org.esa.beam.timeseries.ui.graph.TimeSeriesGraphModel.java
void updateAnnotation(RasterDataNode raster) { removeAnnotation();//from w ww. ja va 2s . c o m final AbstractTimeSeries timeSeries = getTimeSeries(); TimeCoding timeCoding = timeSeries.getRasterTimeMap().get(raster); if (timeCoding != null) { final ProductData.UTC startTime = timeCoding.getStartTime(); final Millisecond timePeriod = new Millisecond(startTime.getAsDate(), ProductData.UTC.UTC_TIME_ZONE, Locale.getDefault()); double millisecond = timePeriod.getFirstMillisecond(); Range valueRange = null; for (int i = 0; i < timeSeriesPlot.getRangeAxisCount(); i++) { valueRange = Range.combine(valueRange, timeSeriesPlot.getRangeAxis(i).getRange()); } if (valueRange != null) { XYAnnotation annotation = new XYLineAnnotation(millisecond, valueRange.getLowerBound(), millisecond, valueRange.getUpperBound()); timeSeriesPlot.addAnnotation(annotation, true); } } }
From source file:userinterface.graph.PrismLogarithmicAxis.java
/** * Adjusts the axis range to match the data range that the axis is * required to display./*from w ww . j ava 2 s . c o m*/ */ 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(); double range = upper - lower; // if fixed auto range, then derive lower bound... double fixedAutoRange = getFixedAutoRange(); if (fixedAutoRange > 0.0) { lower = Math.max(upper - fixedAutoRange, this.smallestValue); } 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; } // apply the margins - these should apply to the exponent range //upper = upper + getUpperMargin() * range; //lower = lower - getLowerMargin() * range; } setRange(new Range(lower, upper), false, false); } }
From source file:ucar.unidata.idv.control.chart.ChartHolder.java
/** * Pan the plot/*from w w w .java2 s .c om*/ * * @param right to right * @param percent by how much */ protected void panPlot(boolean right, double percent) { if (!(plot instanceof XYPlot)) { return; } XYPlot xyPlot = (XYPlot) plot; int cnt = xyPlot.getDomainAxisCount(); for (int i = 0; i < cnt; i++) { ValueAxis axis = (ValueAxis) xyPlot.getDomainAxis(i); org.jfree.data.Range range = axis.getRange(); double width = range.getUpperBound() - range.getLowerBound(); double width2 = width / 2.0; double step = (right ? width * percent : -width * percent); axis.centerRange(range.getLowerBound() + step + width2); } }