/** * Returns the upper bound of the radius axis. * * @return The upper bound. */ public double getMaxRadius() { return this.axis.getUpperBound(); }
final Rectangle getImageSourceArea() { Assert.notNull(image); Assert.notNull(imageDataBounds); final ValueAxis xAxis = getDomainAxis(); final ValueAxis yAxis = getRangeAxis(); final double scaleX = image.getWidth() / imageDataBounds.getWidth(); final double scaleY = image.getHeight() / imageDataBounds.getHeight(); final int x = crop(scaleX * (xAxis.getLowerBound() - imageDataBounds.getMinX()), 0, image.getWidth() - 1); final int y = crop(scaleY * (imageDataBounds.getMaxY() - yAxis.getUpperBound()), 0, image.getHeight() - 1); final int w = crop(scaleX * (xAxis.getUpperBound() - xAxis.getLowerBound()), 1, image.getWidth()); final int h = crop(scaleY * (yAxis.getUpperBound() - yAxis.getLowerBound()), 1, image.getHeight()); return new Rectangle(x, y, w, h); }
final Rectangle getImageSourceArea() { Assert.notNull(image); Assert.notNull(imageDataBounds); final ValueAxis xAxis = getDomainAxis(); final ValueAxis yAxis = getRangeAxis(); final double scaleX = image.getWidth() / imageDataBounds.getWidth(); final double scaleY = image.getHeight() / imageDataBounds.getHeight(); final int x = crop(scaleX * (xAxis.getLowerBound() - imageDataBounds.getMinX()), 0, image.getWidth() - 1); final int y = crop(scaleY * (imageDataBounds.getMaxY() - yAxis.getUpperBound()), 0, image.getHeight() - 1); final int w = crop(scaleX * (xAxis.getUpperBound() - xAxis.getLowerBound()), 1, image.getWidth()); final int h = crop(scaleY * (yAxis.getUpperBound() - yAxis.getLowerBound()), 1, image.getHeight()); return new Rectangle(x, y, w, h); }
public void adjustComponents(ValueAxis axis, int numDecimalPlaces) { adjustComponents(axis.getLowerBound(), axis.getUpperBound(), numDecimalPlaces); }
public void adjustComponents(ValueAxis axis, int numDecimalPlaces) { adjustComponents(axis.getLowerBound(), axis.getUpperBound(), numDecimalPlaces); }
/** * Rescales the axis to ensure that all data are visible. */ public void autoAdjustRange() { this.axis.autoAdjustRange(); this.colorPalette.setMinZ(this.axis.getLowerBound()); this.colorPalette.setMaxZ(this.axis.getUpperBound()); }
fillBand = !fillBand; double end = axis.getUpperBound(); if (fillBand) { getRenderer().fillRangeGridBand(g2, this, axis, dataArea,
/** * Increases or decreases the axis range by the specified percentage about * the specified anchor value and sends an {@link AxisChangeEvent} to all * registered listeners. * <P> * To double the length of the axis range, use 200% (2.0). * To halve the length of the axis range, use 50% (0.5). * * @param percent the resize factor. * @param anchorValue the new central value after the resize. * * @see #resizeRange(double) * * @since 1.0.13 */ public void resizeRange2(double percent, double anchorValue) { if (percent > 0.0) { double left = anchorValue - getLowerBound(); double right = getUpperBound() - anchorValue; Range adjusted = new Range(anchorValue - left * percent, anchorValue + right * percent); setRange(adjusted); } else { setAutoRange(true); } }
/** * Increases or decreases the axis range by the specified percentage about * the specified anchor value and sends an {@link AxisChangeEvent} to all * registered listeners. * <P> * To double the length of the axis range, use 200% (2.0). * To halve the length of the axis range, use 50% (0.5). * * @param percent the resize factor. * @param anchorValue the new central value after the resize. * * @see #resizeRange(double) * * @since 1.0.13 */ public void resizeRange2(double percent, double anchorValue) { if (percent > 0.0) { double left = anchorValue - getLowerBound(); double right = getUpperBound() - anchorValue; Range adjusted = new Range(anchorValue - left * percent, anchorValue + right * percent); setRange(adjusted); } else { setAutoRange(true); } }
/** * Zooms the axis ranges by the specified percentage about the anchor point. * * @param percent the amount of the zoom. */ @Override public void zoom(double percent) { for (int axisIdx = 0; axisIdx < getAxisCount(); axisIdx++) { final ValueAxis axis = getAxis(axisIdx); if (axis != null) { if (percent > 0.0) { double radius = axis.getUpperBound(); double scaledRadius = radius * percent; axis.setUpperBound(scaledRadius); axis.setAutoRange(false); } else { axis.setAutoRange(true); } } } }
/** * Pans the range axes by the specified percentage. * * @param percent the distance to pan (as a percentage of the axis length). * @param info the plot info * @param source the source point where the pan action started. * * @since 1.0.13 */ @Override public void panRangeAxes(double percent, PlotRenderingInfo info, Point2D source) { if (!isRangePannable()) { return; } for (ValueAxis axis : this.rangeAxes.values()) { if (axis == null) { continue; } double length = axis.getRange().getLength(); double adj = percent * length; if (axis.isInverted()) { adj = -adj; } axis.setRange(axis.getLowerBound() + adj, axis.getUpperBound() + adj); } }
/** * Pans the domain axes by the specified percentage. * * @param percent the distance to pan (as a percentage of the axis length). * @param info the plot info * @param source the source point where the pan action started. * * @since 1.0.13 */ @Override public void panDomainAxes(double percent, PlotRenderingInfo info, Point2D source) { if (!isDomainPannable() || this.domainAxis == null) { return; } double length = this.domainAxis.getRange().getLength(); double adj = percent * length; if (this.domainAxis.isInverted()) { adj = -adj; } this.domainAxis.setRange(this.domainAxis.getLowerBound() + adj, this.domainAxis.getUpperBound() + adj); }
/** * Pans the domain axes by the specified percentage. * * @param percent the distance to pan (as a percentage of the axis length). * @param info the plot info * @param source the source point where the pan action started. * * @since 1.0.13 */ public void panDomainAxes(double percent, PlotRenderingInfo info, Point2D source) { if (!isDomainPannable() || this.domainAxis == null) { return; } double length = this.domainAxis.getRange().getLength(); double adj = -percent * length; if (this.domainAxis.isInverted()) { adj = -adj; } this.domainAxis.setRange(this.domainAxis.getLowerBound() + adj, this.domainAxis.getUpperBound() + adj); }
/** * Pans the range axes by the specified percentage. * * @param percent the distance to pan (as a percentage of the axis length). * @param info the plot info * @param source the source point where the pan action started. * * @since 1.0.13 */ @Override public void panRangeAxes(double percent, PlotRenderingInfo info, Point2D source) { if (!isRangePannable() || this.rangeAxis == null) { return; } double length = this.rangeAxis.getRange().getLength(); double adj = percent * length; if (this.rangeAxis.isInverted()) { adj = -adj; } this.rangeAxis.setRange(this.rangeAxis.getLowerBound() + adj, this.rangeAxis.getUpperBound() + adj); }
/** * Pans the range axes by the specified percentage. * * @param percent the distance to pan (as a percentage of the axis length). * @param info the plot info * @param source the source point where the pan action started. * * @since 1.0.13 */ public void panRangeAxes(double percent, PlotRenderingInfo info, Point2D source) { if (!isRangePannable() || this.rangeAxis == null) { return; } double length = this.rangeAxis.getRange().getLength(); double adj = percent * length; if (this.rangeAxis.isInverted()) { adj = -adj; } this.rangeAxis.setRange(this.rangeAxis.getLowerBound() + adj, this.rangeAxis.getUpperBound() + adj); }
/** * Pans the range axes by the specified percentage. * * @param percent the distance to pan (as a percentage of the axis length). * @param info the plot info * @param source the source point where the pan action started. * * @since 1.0.13 */ public void panRangeAxes(double percent, PlotRenderingInfo info, Point2D source) { if (!isRangePannable()) { return; } int rangeAxisCount = getRangeAxisCount(); for (int i = 0; i < rangeAxisCount; i++) { ValueAxis axis = getRangeAxis(i); if (axis == null) { continue; } double length = axis.getRange().getLength(); double adj = percent * length; if (axis.isInverted()) { adj = -adj; } axis.setRange(axis.getLowerBound() + adj, axis.getUpperBound() + adj); } }
private void computeRegressionAndAcceptableDeviationData() { acceptableDeviationDataset.removeAllSeries(); regressionDataset.removeAllSeries(); getPlot().removeAnnotation(r2Annotation); if (computedDatas != null) { final ValueAxis domainAxis = getPlot().getDomainAxis(); final double min = domainAxis.getLowerBound(); final double max = domainAxis.getUpperBound(); acceptableDeviationDataset.addSeries(computeAcceptableDeviationData(min, max)); if (scatterPlotModel.showRegressionLine) { regressionDataset.addSeries(computeRegressionData(min, max)); computeCoefficientOfDetermination(); } } }
private void computeRegressionAndAcceptableDeviationData() { acceptableDeviationDataset.removeAllSeries(); regressionDataset.removeAllSeries(); getPlot().removeAnnotation(r2Annotation); if (computedDatas != null) { final ValueAxis domainAxis = getPlot().getDomainAxis(); final double min = domainAxis.getLowerBound(); final double max = domainAxis.getUpperBound(); acceptableDeviationDataset.addSeries(computeAcceptableDeviationData(min, max)); if (scatterPlotModel.showRegressionLine) { final XYIntervalSeries series = computeRegressionData(min, max); if (series != null) { regressionDataset.addSeries(series); computeCoefficientOfDetermination(); } } } }
public void testImageDataBounds() { final XYImagePlot imagePlot = new XYImagePlot(); assertNull(imagePlot.getDataset()); final Rectangle bounds = new Rectangle(0, 2, 20, 40); imagePlot.setImageDataBounds(bounds); assertNotSame(bounds, imagePlot.getImageDataBounds()); assertEquals(bounds, imagePlot.getImageDataBounds()); assertEquals(0.0, imagePlot.getDomainAxis().getLowerBound(), 1e-10); assertEquals(20.0, imagePlot.getDomainAxis().getUpperBound(), 1e-10); assertEquals(2.0, imagePlot.getRangeAxis().getLowerBound(), 1e-10); assertEquals(42.0, imagePlot.getRangeAxis().getUpperBound(), 1e-10); assertNotNull(imagePlot.getDataset()); }
public void testImageDataBounds() { final XYImagePlot imagePlot = new XYImagePlot(); assertNull(imagePlot.getDataset()); final Rectangle bounds = new Rectangle(0, 2, 20, 40); imagePlot.setImageDataBounds(bounds); assertNotSame(bounds, imagePlot.getImageDataBounds()); assertEquals(bounds, imagePlot.getImageDataBounds()); assertEquals(0.0, imagePlot.getDomainAxis().getLowerBound(), 1e-10); assertEquals(20.0, imagePlot.getDomainAxis().getUpperBound(), 1e-10); assertEquals(2.0, imagePlot.getRangeAxis().getLowerBound(), 1e-10); assertEquals(42.0, imagePlot.getRangeAxis().getUpperBound(), 1e-10); assertNotNull(imagePlot.getDataset()); }