org.jfree.chart.plot.ValueAxisPlot Java Examples
The following examples show how to use
org.jfree.chart.plot.ValueAxisPlot.
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: PeriodAxis.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #2
Source File: PeriodAxis.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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); } }
Example #3
Source File: PeriodAxis.java From SIMVA-SoS with Apache License 2.0 | 5 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(); } 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); } }
Example #4
Source File: ChartComposite.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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)); } }
Example #5
Source File: ChartComposite.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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)); } }
Example #6
Source File: PeriodAxis.java From ECG-Viewer with GNU General Public License v2.0 | 5 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(); } 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); } }
Example #7
Source File: ScalingLogarithmicAxis.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void autoAdjustRange() { super.autoAdjustRange(); if ( getPlot() instanceof ValueAxisPlot ) { final Range range = this.getRange(); setRange( new Range( range.getLowerBound() * 10.0, range.getUpperBound() * 10.0 ), false, false ); setupSmallLogFlag(); } }
Example #8
Source File: ChartComposite.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * 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)); } }
Example #9
Source File: ChartComposite.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * 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)); } }
Example #10
Source File: ChartComposite.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * 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)); } }
Example #11
Source File: PeriodAxis.java From buffer_bci with GNU General Public License v3.0 | 5 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(); } 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); } }
Example #12
Source File: PeriodAxis.java From ccu-historian with GNU General Public License v3.0 | 5 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(); } 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); } }
Example #13
Source File: ChartComposite.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * 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)); } }
Example #14
Source File: PeriodAxis.java From openstock with GNU General Public License v3.0 | 5 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(); } 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); } }
Example #15
Source File: PeriodAxis.java From buffer_bci with GNU General Public License v3.0 | 5 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(); } 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); } }
Example #16
Source File: ChartComposite.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * 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)); } }
Example #17
Source File: SymbolAxis.java From buffer_bci with GNU General Public License v3.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) { // 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); } }
Example #18
Source File: NumberAxis.java From buffer_bci with GNU General Public License v3.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 #19
Source File: LogAxis.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * 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); } }
Example #20
Source File: LogAxis.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * 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); } }
Example #21
Source File: NumberAxis.java From buffer_bci with GNU General Public License v3.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 #22
Source File: SymbolAxis.java From opensim-gui with Apache License 2.0 | 4 votes |
/** * 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); } }
Example #23
Source File: LogAxis.java From astor with GNU General Public License v2.0 | 4 votes |
/** * 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 = 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 = calculateValue(logUpper); lower = calculateValue(logLower); } setRange(new Range(lower, upper), false, false); } }
Example #24
Source File: SymbolAxis.java From buffer_bci with GNU General Public License v3.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) { // 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); } }
Example #25
Source File: SymbolAxis.java From astor with GNU General Public License v2.0 | 4 votes |
/** * 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); } }
Example #26
Source File: NumberAxis.java From astor with GNU General Public License v2.0 | 4 votes |
/** * 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(); } 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 #27
Source File: LogAxis.java From astor with GNU General Public License v2.0 | 4 votes |
/** * 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 = 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 = calculateValue(logUpper); lower = calculateValue(logLower); } setRange(new Range(lower, upper), false, false); } }
Example #28
Source File: SymbolAxis.java From astor with GNU General Public License v2.0 | 4 votes |
/** * 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); } }
Example #29
Source File: NumberAxis.java From astor with GNU General Public License v2.0 | 4 votes |
/** * 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(); } 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 #30
Source File: LogAxis.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * 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); } }