List of usage examples for org.jfree.chart.plot XYPlot getRangeAxisCount
public int getRangeAxisCount()
From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java
/** * Decreases the length of the range axis, centered about the given coordinate on the screen. * The length of the range axis is reduced by the value of {@link #getZoomInFactor()}. * // w w w . java2s.c o m * @param x * the x-coordinate (in screen coordinates). * @param y * the y coordinate (in screen coordinates). */ public void shrinkSelectionOnRange(double x, double y, MouseEvent selectionEvent) { Plot p = this.chart.getPlot(); if (p instanceof XYPlot) { XYPlot plot = (XYPlot) p; Selection selectionObject = new Selection(); for (int i = 0; i < plot.getRangeAxisCount(); i++) { ValueAxis domain = plot.getRangeAxis(i); double zoomFactor = getZoomInFactor(); shrinkSelectionYAxis(x, y, selectionObject, domain, i, zoomFactor); } informSelectionListener(selectionObject, selectionEvent); } }
From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java
/** * Increases the length the range axis, centered about the given coordinate on the screen. The * length of the range axis is increased by the value of {@link #getZoomOutFactor()}. * // w w w .j av a 2 s . c o m * @param x * the x coordinate (in screen coordinates). * @param y * the y-coordinate (in screen coordinates). */ public void enlargeSelectionOnRange(double x, double y, MouseEvent selectionEvent) { Plot p = this.chart.getPlot(); if (p instanceof XYPlot) { XYPlot plot = (XYPlot) p; Selection selectionObject = new Selection(); for (int i = 0; i < plot.getRangeAxisCount(); i++) { ValueAxis domain = plot.getRangeAxis(i); double zoomFactor = getZoomOutFactor(); shrinkSelectionYAxis(x, y, selectionObject, domain, i, zoomFactor); } informSelectionListener(selectionObject, selectionEvent); } }
From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java
private void panAxes(double wPercent, double hPercent, MouseEvent selectionEvent) { Plot p = this.chart.getPlot(); if (p instanceof XYPlot) { XYPlot plot = (XYPlot) p; Selection selectionObject = new Selection(); for (int i = 0; i < plot.getRangeAxisCount(); i++) { ValueAxis axis = plot.getRangeAxis(i); double lowerBound = axis.getLowerBound(); double upperBound = axis.getUpperBound(); double shift = (upperBound - lowerBound) * hPercent; lowerBound += shift;//from www. j av a2s.c om upperBound += shift; Range axisRange = new Range(lowerBound, upperBound); for (String axisName : axisNameResolver.resolveYAxis(i)) { selectionObject.addDelimiter(axisName, axisRange); } } for (int i = 0; i < plot.getDomainAxisCount(); i++) { ValueAxis axis = plot.getDomainAxis(i); double lowerBound = axis.getLowerBound(); double upperBound = axis.getUpperBound(); double shift = (upperBound - lowerBound) * wPercent; lowerBound += shift; upperBound += shift; Range axisRange = new Range(lowerBound, upperBound); for (String axisName : axisNameResolver.resolveXAxis(i)) { selectionObject.addDelimiter(axisName, axisRange); } } informSelectionListener(selectionObject, selectionEvent); } }
From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java
/** * Restores the auto-range calculation on the range axis. *//*from w ww . j av a 2 s.c om*/ public void selectCompleteRangeBounds() { Plot plot = this.chart.getPlot(); if (plot instanceof Zoomable) { Zoomable z = (Zoomable) plot; // here we tweak the notify flag on the plot so that only // one notification happens even though we update multiple // axes... boolean savedNotify = plot.isNotify(); plot.setNotify(false); // we need to guard against this.zoomPoint being null Point2D zp = this.zoomPoint != null ? this.zoomPoint : new Point(); z.zoomRangeAxes(0.0, this.info.getPlotInfo(), zp); plot.setNotify(savedNotify); if (plot instanceof XYPlot) { XYPlot xyPlot = (XYPlot) plot; Selection selectionObject = new Selection(); for (int i = 0; i < xyPlot.getRangeAxisCount(); i++) { ValueAxis range = xyPlot.getRangeAxis(i); Range axisRange = new Range(range.getLowerBound(), range.getUpperBound()); for (String axisName : axisNameResolver.resolveYAxis(i)) { selectionObject.addDelimiter(axisName, axisRange); } } informSelectionListener(selectionObject, null); } } }
From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java
public void selectRectangle(Rectangle2D selection, MouseEvent selectionEvent) { Rectangle2D scaledDataArea = getScreenDataArea((int) selection.getCenterX(), (int) selection.getCenterY()); if (selection.getHeight() > 0 && selection.getWidth() > 0) { double hLower = (selection.getMinX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth(); double hUpper = (selection.getMaxX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth(); double vLower = (scaledDataArea.getMaxY() - selection.getMaxY()) / scaledDataArea.getHeight(); double vUpper = (scaledDataArea.getMaxY() - selection.getMinY()) / scaledDataArea.getHeight(); Plot p = this.chart.getPlot(); if (p instanceof XYPlot) { XYPlot plot = (XYPlot) p; Selection selectionObject = new Selection(); for (int i = 0; i < plot.getDomainAxisCount(); i++) { ValueAxis domain = plot.getDomainAxis(i); double lowerDomain = domain.getLowerBound(); double upperDomain = domain.getUpperBound(); Range axisRange = new Range(lowerDomain + (upperDomain - lowerDomain) * hLower, lowerDomain + (upperDomain - lowerDomain) * hUpper); for (String axisName : axisNameResolver.resolveXAxis(i)) { selectionObject.addDelimiter(axisName, axisRange); }//from w ww. ja v a2 s . c om } for (int i = 0; i < plot.getRangeAxisCount(); i++) { ValueAxis range = plot.getRangeAxis(i); double lowerRange = range.getLowerBound(); double upperRange = range.getUpperBound(); Range axisRange = new Range(lowerRange + (upperRange - lowerRange) * vLower, lowerRange + (upperRange - lowerRange) * vUpper); for (String axisName : axisNameResolver.resolveYAxis(i)) { selectionObject.addDelimiter(axisName, axisRange); } } informSelectionListener(selectionObject, selectionEvent); } } }