/** * Rescales the axis to ensure that all data is visible. */ 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(); } long upper = Math.round(r.getUpperBound()); long lower = Math.round(r.getLowerBound()); this.first = createInstance(this.autoRangeTimePeriodClass, new Date(lower), this.timeZone); this.last = createInstance(this.autoRangeTimePeriodClass, new Date(upper), this.timeZone); setRange(r, false, false); } }
/** * Rescales the axis to ensure that all data is visible. */ 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(); } long upper = Math.round(r.getUpperBound()); long lower = Math.round(r.getLowerBound()); this.first = createInstance(this.autoRangeTimePeriodClass, new Date(lower), this.timeZone, this.locale); this.last = createInstance(this.autoRangeTimePeriodClass, new Date(upper), this.timeZone, this.locale); setRange(r, false, false); } }
/** * Rescales the axis to ensure that all data is visible. */ 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 = new Range(DEFAULT_LOWER_BOUND, DEFAULT_UPPER_BOUND); } long upper = Math.round(r.getUpperBound()); long lower = Math.round(r.getLowerBound()); this.first = createInstance(this.autoRangeTimePeriodClass, new Date(lower), this.timeZone); this.last = createInstance(this.autoRangeTimePeriodClass, new Date(upper), this.timeZone); setRange(r, false, false); } }
/** * Increases the range on the vertical axis, centered about a Java2D y coordinate. * <P> * The range on the y axis is doubled. * * @param y the y coordinate in Java2D space. */ public void zoomOutVertical(double y) { Plot p = this.chart.getPlot(); if (p instanceof ValueAxisPlot) { ValueAxisPlot plot = (ValueAxisPlot) p; plot.zoomVerticalAxes(this.zoomOutFactor); } }
/** * Zooms in on a selected region. * * @param selection the selected region. */ public void zoom(Rectangle2D selection) { double hLower = 0.0; double hUpper = 0.0; double vLower = 0.0; double vUpper = 0.0; if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) { Rectangle2D scaledDataArea = getScaledDataArea(); hLower = (selection.getMinX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth(); hUpper = (selection.getMaxX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth(); vLower = (scaledDataArea.getMaxY() - selection.getMaxY()) / scaledDataArea.getHeight(); vUpper = (scaledDataArea.getMaxY() - selection.getMinY()) / scaledDataArea.getHeight(); LOGGER.debug("hLower = " + hLower); LOGGER.debug("hUpper = " + hUpper); LOGGER.debug("vLower = " + vLower); LOGGER.debug("vUpper = " + vUpper); Plot p = this.chart.getPlot(); if (p instanceof ValueAxisPlot) { ValueAxisPlot plot = (ValueAxisPlot) p; plot.zoomHorizontalAxes(hLower, hUpper); plot.zoomVerticalAxes(vLower, vUpper); } } }
/** * Restores the auto-range calculation on the horizontal axis. */ public void autoRangeHorizontal() { Plot p = this.chart.getPlot(); if (p instanceof ValueAxisPlot) { ValueAxisPlot plot = (ValueAxisPlot) p; plot.zoomHorizontalAxes(0.0); } }
/** * Restores the auto-range calculation on the vertical axis. */ public void autoRangeVertical() { Plot p = this.chart.getPlot(); if (p instanceof ValueAxisPlot) { ValueAxisPlot plot = (ValueAxisPlot) p; plot.zoomVerticalAxes(0.0); } }
/** * Restores the auto-range calculation on the range axis. */ public void restoreAutoRangeBounds() { Plot p = this.chart.getPlot(); if (p instanceof ValueAxisPlot) { Zoomable z = (Zoomable) p; z.zoomRangeAxes(0.0, this.info.getPlotInfo(), SWTUtils.toAwtPoint(this.zoomPoint)); } }
/** * Restores the auto-range calculation on the range axis. */ public void restoreAutoRangeBounds() { Plot p = this.chart.getPlot(); if (p instanceof ValueAxisPlot) { Zoomable z = (Zoomable) p; // we need to guard against this.zoomPoint being null org.eclipse.swt.graphics.Point zp = (this.zoomPoint != null ? this.zoomPoint : new org.eclipse.swt.graphics.Point(0, 0)); z.zoomRangeAxes(0.0, this.info.getPlotInfo(), SWTUtils.toAwtPoint(zp)); } }
/** * 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(); } long upper = Math.round(r.getUpperBound()); long lower = Math.round(r.getLowerBound()); this.first = createInstance(this.autoRangeTimePeriodClass, new Date(lower), this.timeZone, this.locale); this.last = createInstance(this.autoRangeTimePeriodClass, new Date(upper), this.timeZone, this.locale); setRange(r, false, false); } }
/** * when the plot is resized, we want to return to the default auto range, not the freshly * calculated one. */ protected final void autoAdjustRange() { Plot plot = getPlot(); if (plot != null && plot instanceof ValueAxisPlot) { Range r = getDefaultAutoRange(); setRange(r, false, false); } else { super.autoAdjustRange(); } }
public void autoAdjustRange(){ Plot plot = getPlot(); if(plot != null && plot instanceof ValueAxisPlot){ Range r = getDefaultAutoRange(); setRange(r, false, false); } }
/** * Rescales the axis to ensure that all data is visible. */ protected void autoAdjustRange() { Plot plot = getPlot(); if (plot == null) { return; // no plot, no data } if (plot instanceof ValueAxisPlot) { //ensure that all the symbolic value are displayed double upper = this.symbolicValue.size() - 1; double lower = 0; double range = upper - lower; // ensure the autorange is at least <minRange> in size... double minRange = getAutoRangeMinimumSize(); if (range < minRange) { upper = (upper + lower + minRange) / 2; lower = (upper + lower - minRange) / 2; } //this ensure that the symbolic grid lines will be displayed //correctly. double upperMargin = 0.5; double lowerMargin = 0.5; if (autoRangeIncludesZero()) { if (autoRangeStickyZero()) { if (upper <= 0.0) { upper = 0.0; } else { upper = upper + upperMargin; } if (lower >= 0.0) { lower = 0.0; } else { lower = lower - lowerMargin; } } else { upper = Math.max(0.0, upper + upperMargin); lower = Math.min(0.0, lower - lowerMargin); } } else { if (autoRangeStickyZero()) { if (upper <= 0.0) { upper = Math.min(0.0, upper + upperMargin); } else { upper = upper + upperMargin * range; } if (lower >= 0.0) { lower = Math.max(0.0, lower - lowerMargin); } else { lower = lower - lowerMargin; } } else { upper = upper + upperMargin; lower = lower - lowerMargin; } } setRange(new Range(lower, upper), false, false); } }
/** * Adjusts the axis range to match the data range that the axis is * required to display. */ 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); } }
/** * Rescales the axis to ensure that all data is visible. */ protected void autoAdjustRange() { Plot plot = getPlot(); if (plot == null) { return; // no plot, no data } if (plot instanceof ValueAxisPlot) { // ensure that all the symbols are displayed double upper = this.symbols.size() - 1; double lower = 0; double range = upper - lower; // ensure the autorange is at least <minRange> in size... double minRange = getAutoRangeMinimumSize(); if (range < minRange) { upper = (upper + lower + minRange) / 2; lower = (upper + lower - minRange) / 2; } // this ensure that the grid bands will be displayed correctly. double upperMargin = 0.5; double lowerMargin = 0.5; if (getAutoRangeIncludesZero()) { if (getAutoRangeStickyZero()) { if (upper <= 0.0) { upper = 0.0; } else { upper = upper + upperMargin; } if (lower >= 0.0) { lower = 0.0; } else { lower = lower - lowerMargin; } } else { upper = Math.max(0.0, upper + upperMargin); lower = Math.min(0.0, lower - lowerMargin); } } else { if (getAutoRangeStickyZero()) { if (upper <= 0.0) { upper = Math.min(0.0, upper + upperMargin); } else { upper = upper + upperMargin * range; } if (lower >= 0.0) { lower = Math.max(0.0, lower - lowerMargin); } else { lower = lower - lowerMargin; } } else { upper = upper + upperMargin; lower = lower - lowerMargin; } } setRange(new Range(lower, upper), false, false); } }
/** * 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) { // ensure that all the symbols are displayed double upper = this.symbols.size() - 1; double lower = 0; double range = upper - lower; // ensure the autorange is at least <minRange> in size... double minRange = getAutoRangeMinimumSize(); if (range < minRange) { upper = (upper + lower + minRange) / 2; lower = (upper + lower - minRange) / 2; } // this ensure that the grid bands will be displayed correctly. double upperMargin = 0.5; double lowerMargin = 0.5; if (getAutoRangeIncludesZero()) { if (getAutoRangeStickyZero()) { if (upper <= 0.0) { upper = 0.0; } else { upper = upper + upperMargin; } if (lower >= 0.0) { lower = 0.0; } else { lower = lower - lowerMargin; } } else { upper = Math.max(0.0, upper + upperMargin); lower = Math.min(0.0, lower - lowerMargin); } } else { if (getAutoRangeStickyZero()) { if (upper <= 0.0) { upper = Math.min(0.0, upper + upperMargin); } else { upper = upper + upperMargin * range; } if (lower >= 0.0) { lower = Math.max(0.0, lower - lowerMargin); } else { lower = lower - lowerMargin; } } else { upper = upper + upperMargin; lower = lower - lowerMargin; } } setRange(new Range(lower, upper), false, false); } }
/** * Adjusts the axis range to match the data range that the axis is * required to display. */ @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 = Math.max(r.getLowerBound(), this.smallestValue); 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 double logUpper = calculateLog(upper); double logLower = calculateLog(lower); double logRange = logUpper - logLower; logUpper = logUpper + getUpperMargin() * logRange; logLower = logLower - getLowerMargin() * logRange; upper = calculateValueNoINF(logUpper); lower = calculateValueNoINF(logLower); } setRange(new Range(lower, upper), false, false); } }