org.jfree.data.RangeType Java Examples
The following examples show how to use
org.jfree.data.RangeType.
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: RangeTypeTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { RangeType r1 = RangeType.FULL; RangeType r2 = RangeType.FULL; assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #2
Source File: NumberAxis.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #3
Source File: NumberAxisTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { NumberAxis a1 = new NumberAxis("Test"); NumberAxis a2 = new NumberAxis("Test"); assertTrue(a1.equals(a2)); //private boolean autoRangeIncludesZero; a1.setAutoRangeIncludesZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeIncludesZero(false); assertTrue(a1.equals(a2)); //private boolean autoRangeStickyZero; a1.setAutoRangeStickyZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeStickyZero(false); assertTrue(a1.equals(a2)); //private NumberTickUnit tickUnit; a1.setTickUnit(new NumberTickUnit(25.0)); assertFalse(a1.equals(a2)); a2.setTickUnit(new NumberTickUnit(25.0)); assertTrue(a1.equals(a2)); //private NumberFormat numberFormatOverride; a1.setNumberFormatOverride(new DecimalFormat("0.00")); assertFalse(a1.equals(a2)); a2.setNumberFormatOverride(new DecimalFormat("0.00")); assertTrue(a1.equals(a2)); a1.setRangeType(RangeType.POSITIVE); assertFalse(a1.equals(a2)); a2.setRangeType(RangeType.POSITIVE); assertTrue(a1.equals(a2)); }
Example #4
Source File: RangeTypeTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the equals() method. */ public void testEquals() { assertEquals(RangeType.FULL, RangeType.FULL); assertEquals(RangeType.NEGATIVE, RangeType.NEGATIVE); assertEquals(RangeType.POSITIVE, RangeType.POSITIVE); assertFalse(RangeType.FULL.equals(RangeType.NEGATIVE)); assertFalse(RangeType.FULL.equals(RangeType.POSITIVE)); assertFalse(RangeType.FULL.equals(null)); assertFalse(RangeType.NEGATIVE.equals(RangeType.FULL)); assertFalse(RangeType.NEGATIVE.equals(RangeType.POSITIVE)); assertFalse(RangeType.NEGATIVE.equals(null)); assertFalse(RangeType.POSITIVE.equals(RangeType.NEGATIVE)); assertFalse(RangeType.POSITIVE.equals(RangeType.FULL)); assertFalse(RangeType.POSITIVE.equals(null)); }
Example #5
Source File: RangeTypeTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashCode() { RangeType r1 = RangeType.FULL; RangeType r2 = RangeType.FULL; assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #6
Source File: NumberAxis.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #7
Source File: NumberAxis.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Sets the axis range type. * * @param rangeType the range type (<code>null</code> not permitted). * * @see #getRangeType() */ public void setRangeType(RangeType rangeType) { if (rangeType == null) { throw new IllegalArgumentException("Null 'rangeType' argument."); } this.rangeType = rangeType; notifyListeners(new AxisChangeEvent(this)); }
Example #8
Source File: NumberAxisTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { NumberAxis a1 = new NumberAxis("Test"); NumberAxis a2 = new NumberAxis("Test"); assertTrue(a1.equals(a2)); //private boolean autoRangeIncludesZero; a1.setAutoRangeIncludesZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeIncludesZero(false); assertTrue(a1.equals(a2)); //private boolean autoRangeStickyZero; a1.setAutoRangeStickyZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeStickyZero(false); assertTrue(a1.equals(a2)); //private NumberTickUnit tickUnit; a1.setTickUnit(new NumberTickUnit(25.0)); assertFalse(a1.equals(a2)); a2.setTickUnit(new NumberTickUnit(25.0)); assertTrue(a1.equals(a2)); //private NumberFormat numberFormatOverride; a1.setNumberFormatOverride(new DecimalFormat("0.00")); assertFalse(a1.equals(a2)); a2.setNumberFormatOverride(new DecimalFormat("0.00")); assertTrue(a1.equals(a2)); a1.setRangeType(RangeType.POSITIVE); assertFalse(a1.equals(a2)); a2.setRangeType(RangeType.POSITIVE); assertTrue(a1.equals(a2)); }
Example #9
Source File: RangeTypeTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the equals() method. */ public void testEquals() { assertEquals(RangeType.FULL, RangeType.FULL); assertEquals(RangeType.NEGATIVE, RangeType.NEGATIVE); assertEquals(RangeType.POSITIVE, RangeType.POSITIVE); assertFalse(RangeType.FULL.equals(RangeType.NEGATIVE)); assertFalse(RangeType.FULL.equals(RangeType.POSITIVE)); assertFalse(RangeType.FULL.equals(null)); assertFalse(RangeType.NEGATIVE.equals(RangeType.FULL)); assertFalse(RangeType.NEGATIVE.equals(RangeType.POSITIVE)); assertFalse(RangeType.NEGATIVE.equals(null)); assertFalse(RangeType.POSITIVE.equals(RangeType.NEGATIVE)); assertFalse(RangeType.POSITIVE.equals(RangeType.FULL)); assertFalse(RangeType.POSITIVE.equals(null)); }
Example #10
Source File: NumberAxis.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #11
Source File: NumberAxis.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #12
Source File: NumberAxis.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Sets the axis range type. * * @param rangeType the range type (<code>null</code> not permitted). * * @see #getRangeType() */ public void setRangeType(RangeType rangeType) { if (rangeType == null) { throw new IllegalArgumentException("Null 'rangeType' argument."); } this.rangeType = rangeType; notifyListeners(new AxisChangeEvent(this)); }
Example #13
Source File: NumberAxis.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #14
Source File: NumberAxis.java From opensim-gui with Apache License 2.0 | 5 votes |
/** * Sets the axis range type. * * @param rangeType the range type (<code>null</code> not permitted). */ public void setRangeType(RangeType rangeType) { if (rangeType == null) { throw new IllegalArgumentException("Null 'rangeType' argument."); } this.rangeType = rangeType; notifyListeners(new AxisChangeEvent(this)); }
Example #15
Source File: NumberAxisTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ @Test public void testEquals() { NumberAxis a1 = new NumberAxis("Test"); NumberAxis a2 = new NumberAxis("Test"); assertTrue(a1.equals(a2)); //private boolean autoRangeIncludesZero; a1.setAutoRangeIncludesZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeIncludesZero(false); assertTrue(a1.equals(a2)); //private boolean autoRangeStickyZero; a1.setAutoRangeStickyZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeStickyZero(false); assertTrue(a1.equals(a2)); //private NumberTickUnit tickUnit; a1.setTickUnit(new NumberTickUnit(25.0)); assertFalse(a1.equals(a2)); a2.setTickUnit(new NumberTickUnit(25.0)); assertTrue(a1.equals(a2)); //private NumberFormat numberFormatOverride; a1.setNumberFormatOverride(new DecimalFormat("0.00")); assertFalse(a1.equals(a2)); a2.setNumberFormatOverride(new DecimalFormat("0.00")); assertTrue(a1.equals(a2)); a1.setRangeType(RangeType.POSITIVE); assertFalse(a1.equals(a2)); a2.setRangeType(RangeType.POSITIVE); assertTrue(a1.equals(a2)); }
Example #16
Source File: NumberAxis.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #17
Source File: NumberAxis.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #18
Source File: NumberAxisTest.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ @Test public void testEquals() { NumberAxis a1 = new NumberAxis("Test"); NumberAxis a2 = new NumberAxis("Test"); assertTrue(a1.equals(a2)); //private boolean autoRangeIncludesZero; a1.setAutoRangeIncludesZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeIncludesZero(false); assertTrue(a1.equals(a2)); //private boolean autoRangeStickyZero; a1.setAutoRangeStickyZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeStickyZero(false); assertTrue(a1.equals(a2)); //private NumberTickUnit tickUnit; a1.setTickUnit(new NumberTickUnit(25.0)); assertFalse(a1.equals(a2)); a2.setTickUnit(new NumberTickUnit(25.0)); assertTrue(a1.equals(a2)); //private NumberFormat numberFormatOverride; a1.setNumberFormatOverride(new DecimalFormat("0.00")); assertFalse(a1.equals(a2)); a2.setNumberFormatOverride(new DecimalFormat("0.00")); assertTrue(a1.equals(a2)); a1.setRangeType(RangeType.POSITIVE); assertFalse(a1.equals(a2)); a2.setRangeType(RangeType.POSITIVE); assertTrue(a1.equals(a2)); }
Example #19
Source File: NumberAxisTest.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ @Test public void testEquals() { NumberAxis a1 = new NumberAxis("Test"); NumberAxis a2 = new NumberAxis("Test"); assertTrue(a1.equals(a2)); //private boolean autoRangeIncludesZero; a1.setAutoRangeIncludesZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeIncludesZero(false); assertTrue(a1.equals(a2)); //private boolean autoRangeStickyZero; a1.setAutoRangeStickyZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeStickyZero(false); assertTrue(a1.equals(a2)); //private NumberTickUnit tickUnit; a1.setTickUnit(new NumberTickUnit(25.0)); assertFalse(a1.equals(a2)); a2.setTickUnit(new NumberTickUnit(25.0)); assertTrue(a1.equals(a2)); //private NumberFormat numberFormatOverride; a1.setNumberFormatOverride(new DecimalFormat("0.00")); assertFalse(a1.equals(a2)); a2.setNumberFormatOverride(new DecimalFormat("0.00")); assertTrue(a1.equals(a2)); a1.setRangeType(RangeType.POSITIVE); assertFalse(a1.equals(a2)); a2.setRangeType(RangeType.POSITIVE); assertTrue(a1.equals(a2)); }
Example #20
Source File: NumberAxisTest.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ @Test public void testEquals() { NumberAxis a1 = new NumberAxis("Test"); NumberAxis a2 = new NumberAxis("Test"); assertTrue(a1.equals(a2)); //private boolean autoRangeIncludesZero; a1.setAutoRangeIncludesZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeIncludesZero(false); assertTrue(a1.equals(a2)); //private boolean autoRangeStickyZero; a1.setAutoRangeStickyZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeStickyZero(false); assertTrue(a1.equals(a2)); //private NumberTickUnit tickUnit; a1.setTickUnit(new NumberTickUnit(25.0)); assertFalse(a1.equals(a2)); a2.setTickUnit(new NumberTickUnit(25.0)); assertTrue(a1.equals(a2)); //private NumberFormat numberFormatOverride; a1.setNumberFormatOverride(new DecimalFormat("0.00")); assertFalse(a1.equals(a2)); a2.setNumberFormatOverride(new DecimalFormat("0.00")); assertTrue(a1.equals(a2)); a1.setRangeType(RangeType.POSITIVE); assertFalse(a1.equals(a2)); a2.setRangeType(RangeType.POSITIVE); assertTrue(a1.equals(a2)); }
Example #21
Source File: NumberAxis.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #22
Source File: NumberAxis.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Constructs a number axis, using default values where necessary. * * @param label the axis label (<code>null</code> permitted). */ public NumberAxis(String label) { super(label, NumberAxis.createStandardTickUnits()); this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; }
Example #23
Source File: NumberAxisTest.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ @Test public void testEquals() { NumberAxis a1 = new NumberAxis("Test"); NumberAxis a2 = new NumberAxis("Test"); assertTrue(a1.equals(a2)); //private boolean autoRangeIncludesZero; a1.setAutoRangeIncludesZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeIncludesZero(false); assertTrue(a1.equals(a2)); //private boolean autoRangeStickyZero; a1.setAutoRangeStickyZero(false); assertFalse(a1.equals(a2)); a2.setAutoRangeStickyZero(false); assertTrue(a1.equals(a2)); //private NumberTickUnit tickUnit; a1.setTickUnit(new NumberTickUnit(25.0)); assertFalse(a1.equals(a2)); a2.setTickUnit(new NumberTickUnit(25.0)); assertTrue(a1.equals(a2)); //private NumberFormat numberFormatOverride; a1.setNumberFormatOverride(new DecimalFormat("0.00")); assertFalse(a1.equals(a2)); a2.setNumberFormatOverride(new DecimalFormat("0.00")); assertTrue(a1.equals(a2)); a1.setRangeType(RangeType.POSITIVE); assertFalse(a1.equals(a2)); a2.setRangeType(RangeType.POSITIVE); assertTrue(a1.equals(a2)); }
Example #24
Source File: ChromatogramPlotWindowController.java From old-mzmine3 with GNU General Public License v2.0 | 4 votes |
@FXML public void initialize() { final JFreeChart chart = chartNode.getChart(); final XYPlot plot = chart.getXYPlot(); // Do not set colors and strokes dynamically. They are instead provided // by the dataset and configured in configureRenderer() plot.setDrawingSupplier(null); plot.setDomainGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setRangeGridlinePaint(JavaFXUtil.convertColorToAWT(gridColor)); plot.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.setDomainCrosshairPaint(JavaFXUtil.convertColorToAWT(crossHairColor)); plot.setRangeCrosshairPaint(JavaFXUtil.convertColorToAWT(crossHairColor)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); // chart properties chart.setBackgroundPaint(JavaFXUtil.convertColorToAWT(backgroundColor)); // legend properties LegendTitle legend = chart.getLegend(); // legend.setItemFont(legendFont); legend.setFrame(BlockBorder.NONE); // set the X axis (retention time) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setLabel("Retention time (min)"); xAxis.setUpperMargin(0.03); xAxis.setLowerMargin(0.03); xAxis.setRangeType(RangeType.POSITIVE); xAxis.setTickLabelInsets(new RectangleInsets(0, 0, 20, 20)); // set the Y axis (intensity) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setLabel("Intensity"); yAxis.setRangeType(RangeType.POSITIVE); yAxis.setAutoRangeIncludesZero(true); // set the fixed number formats, because otherwise JFreeChart sometimes // shows exponent, sometimes it doesn't DecimalFormat mzFormat = MZmineCore.getConfiguration().getMZFormat(); xAxis.setNumberFormatOverride(mzFormat); DecimalFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat(); yAxis.setNumberFormatOverride(intensityFormat); chartTitle = chartNode.getChart().getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chartTitle.setText("Chromatogram"); chartNode.setCursor(Cursor.CROSSHAIR); // Remove the dataset if it is removed from the list datasets.addListener((Change<? extends ChromatogramPlotDataSet> c) -> { while (c.next()) { if (c.wasRemoved()) { for (ChromatogramPlotDataSet ds : c.getRemoved()) { int index = plot.indexOf(ds); plot.setDataset(index, null); } } } }); itemLabelsVisible.addListener((prop, oldVal, newVal) -> { for (ChromatogramPlotDataSet dataset : datasets) { int datasetIndex = plot.indexOf(dataset); XYItemRenderer renderer = plot.getRenderer(datasetIndex); renderer.setBaseItemLabelsVisible(newVal); } }); legendVisible.addListener((prop, oldVal, newVal) -> { legend.setVisible(newVal); }); }
Example #25
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 #26
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 #27
Source File: NumberAxis.java From openstock 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 #28
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 #29
Source File: NumberAxis.java From ccu-historian 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 #30
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); } }