domain.setAutoRange(true); ValueAxis range = plot.getRangeAxis(); range.setRange(-MINMAX, MINMAX); return result;
/** * Sets the range for the axis and sends a change event to all registered * listeners. As a side-effect, the auto-range flag is set to * {@code false}. * * @param range the range ({@code null} not permitted). * * @see #getRange() */ public void setRange(Range range) { // defer argument checking setRange(range, true, true); }
/** * Sets the range attribute and sends an {@link AxisChangeEvent} to all * registered listeners. As a side-effect, the auto-range flag is set to * <code>false</code>. * * @param range the range (<code>null</code> not permitted). * * @see #getRange() */ public void setRange(Range range) { // defer argument checking setRange(range, true, true); }
/** * Sets the axis range to the current values in the rangeInfo array. */ protected void setAxisRange() { if ((this.subrange >= 0) && (this.followDataInSubranges)) { this.rangeAxis.setRange( new Range(this.subrangeInfo[this.subrange][DISPLAY_LOW], this.subrangeInfo[this.subrange][DISPLAY_HIGH])); } else { this.rangeAxis.setRange(this.lowerBound, this.upperBound); } }
/** * Sets the axis range, where the new range is 'size' in length, and * centered on 'value'. * * @param value the central value. * @param length the range length. */ public void setRangeAboutValue(double value, double length) { setRange(new Range(value - length / 2, value + length / 2)); }
private static ValueAxis createPercentileAxis(String axisName) { ValueAxis valueAxis = createNumberAxis(axisName); valueAxis.setRange(0D, 100.1D); return valueAxis; }
/** * Sets the axis range, where the new range is 'size' in length, and * centered on 'value'. * * @param value the central value. * @param length the range length. */ public void setRangeAboutValue(double value, double length) { setRange(new Range(value - length / 2, value + length / 2)); }
public void setYRange(Double ymin, Double ymax) { if (ymin != null && ymax != null) plot.getRangeAxis().setRange(ymin, ymax); }
public XYChartBuilder setDateXAxisRange(final Date lower, final Date upper) { if (xAxis == null) { throw new IllegalArgumentException("Call set*XAxis first. No xAxis given yet."); } xAxis.setRange(new DateRange(lower, upper)); return this; }
public void setImageDataBounds(Rectangle2D imageDataBounds) { synchronized (imageLock) { this.imageDataBounds = (Rectangle2D) imageDataBounds.clone(); DefaultXYDataset xyDataset = new DefaultXYDataset(); xyDataset.addSeries("Image Data Bounds", new double[][]{ {imageDataBounds.getMinX(), imageDataBounds.getMaxX()}, {imageDataBounds.getMinY(), imageDataBounds.getMaxY()} }); setDataset(xyDataset); getDomainAxis().setRange(imageDataBounds.getMinX(), imageDataBounds.getMaxX()); getRangeAxis().setRange(imageDataBounds.getMinY(), imageDataBounds.getMaxY()); } }
private void updatePlotBounds(Range newBounds, ValueAxis axis, int index) { if (newBounds != null) { final Range axisBounds = axis.getRange(); final Range oldBounds = this.plotBounds[index]; this.plotBounds[index] = getNewRange(newBounds, this.plotBounds[index], axisBounds); if (oldBounds != this.plotBounds[index]) { axis.setRange(getNewPlotBounds(this.plotBounds[index])); } } }
private void updatePlotBounds(Range newBounds, ValueAxis axis, int index) { if (newBounds != null) { final Range axisBounds = axis.getRange(); final Range oldBounds = this.plotBounds[index]; this.plotBounds[index] = getNewRange(newBounds, this.plotBounds[index], axisBounds); if (oldBounds != this.plotBounds[index]) { axis.setRange(getNewPlotBounds(this.plotBounds[index])); } } }
/** * Centers the axis range about the specified value and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param value the center value. */ public void centerRange(double value) { double central = this.range.getCentralValue(); Range adjusted = new Range(this.range.getLowerBound() + value - central, this.range.getUpperBound() + value - central); setRange(adjusted); }
@OnAwt @Override public void setAutoZoomRange(boolean flag) { if (!flag) { return; } ChartPanel panel = this.panel; panel.restoreAutoRangeBounds(); if (rangeAxis != null) { chart.getXYPlot().getRangeAxis().setRange(rangeAxis); } }
/** * Centers the axis range about the specified value and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param value the center value. */ public void centerRange(double value) { double central = this.range.getCentralValue(); Range adjusted = new Range(this.range.getLowerBound() + value - central, this.range.getUpperBound() + value - central); setRange(adjusted); }
@Override public void write(OutputStream aStream) throws IOException { JFreeChart chart = ChartFactory.createXYLineChart(null, "Recall", "Precision", dataset, PlotOrientation.VERTICAL, false, false, false); chart.getXYPlot().setRenderer(new XYSplineRenderer()); chart.getXYPlot().getRangeAxis().setRange(0.0, 1.0); chart.getXYPlot().getDomainAxis().setRange(0.0, 1.0); ChartUtil.writeChartAsSVG(aStream, chart, 400, 400); } }
XYPlot plot = chart.getXYPlot(); final ValueAxis domain = plot.getDomainAxis(); domain.setAutoRange(true); NumberAxis axis = new NumberAxis(); axis.setTickUnit(new NumberTickUnit(100)); ValueAxis range = plot.getRangeAxis(); range.setRange(0, 100);
public void adjustAxis(ValueAxis axis, int numDecimalPlaces) { final double lowerRange = MathUtils.round((Double) getBindingContext().getBinding("min").getPropertyValue(), roundFactor(numDecimalPlaces)); final double upperRange = MathUtils.round((Double) getBindingContext().getBinding("max").getPropertyValue(), roundFactor(numDecimalPlaces)); axis.setRange(lowerRange, upperRange); }
public void adjustAxis(ValueAxis axis, int numDecimalPlaces) { final double lowerRange = MathUtils.round((Double) getBindingContext().getBinding("min").getPropertyValue(), roundFactor(numDecimalPlaces)); final double upperRange = MathUtils.round((Double) getBindingContext().getBinding("max").getPropertyValue(), roundFactor(numDecimalPlaces)); axis.setRange(lowerRange, upperRange); }