Java Code Examples for org.jfree.chart.ChartPanel#isRangeZoomable()
The following examples show how to use
org.jfree.chart.ChartPanel#isRangeZoomable() .
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: ZoomHandler.java From astor with GNU General Public License v2.0 | 4 votes |
public void mouseReleased(MouseEvent e) { if (this.zoomRectangle == null) { return; } ChartPanel panel = (ChartPanel) e.getSource(); boolean hZoom = false; boolean vZoom = false; if (panel.getOrientation() == PlotOrientation.HORIZONTAL) { hZoom = panel.isRangeZoomable(); vZoom = panel.isDomainZoomable(); } else { hZoom = panel.isDomainZoomable(); vZoom = panel.isRangeZoomable(); } boolean zoomTrigger1 = hZoom && Math.abs(e.getX() - this.zoomPoint.getX()) >= panel.getZoomTriggerDistance(); boolean zoomTrigger2 = vZoom && Math.abs(e.getY() - this.zoomPoint.getY()) >= panel.getZoomTriggerDistance(); if (zoomTrigger1 || zoomTrigger2) { if ((hZoom && (e.getX() < this.zoomPoint.getX())) || (vZoom && (e.getY() < this.zoomPoint.getY()))) { panel.restoreAutoBounds(); } else { double x, y, w, h; Rectangle2D screenDataArea = panel.getScreenDataArea( (int) this.zoomPoint.getX(), (int) this.zoomPoint.getY()); double maxX = screenDataArea.getMaxX(); double maxY = screenDataArea.getMaxY(); // for mouseReleased event, (horizontalZoom || verticalZoom) // will be true, so we can just test for either being false; // otherwise both are true if (!vZoom) { x = this.zoomPoint.getX(); y = screenDataArea.getMinY(); w = Math.min(this.zoomRectangle.getWidth(), maxX - this.zoomPoint.getX()); h = screenDataArea.getHeight(); } else if (!hZoom) { x = screenDataArea.getMinX(); y = this.zoomPoint.getY(); w = screenDataArea.getWidth(); h = Math.min(this.zoomRectangle.getHeight(), maxY - this.zoomPoint.getY()); } else { x = this.zoomPoint.getX(); y = this.zoomPoint.getY(); w = Math.min(this.zoomRectangle.getWidth(), maxX - this.zoomPoint.getX()); h = Math.min(this.zoomRectangle.getHeight(), maxY - this.zoomPoint.getY()); } Rectangle2D zoomArea = new Rectangle2D.Double(x, y, w, h); panel.zoom(zoomArea); } this.zoomPoint = null; this.zoomRectangle = null; panel.setZoomRectangle(null); panel.clearLiveMouseHandler(); } else { // erase the zoom rectangle Graphics2D g2 = (Graphics2D) panel.getGraphics(); if (panel.getUseBuffer()) { panel.repaint(); } else { drawZoomRectangle(panel, g2, true); } g2.dispose(); this.zoomPoint = null; this.zoomRectangle = null; panel.setZoomRectangle(null); panel.clearLiveMouseHandler(); } }
Example 2
Source File: ChartLogics.java From mzmine3 with GNU General Public License v2.0 | 2 votes |
/** * * @param chartPanel * @return */ public static boolean isMouseZoomable(ChartPanel chartPanel) { return chartPanel instanceof EChartPanel ? ((EChartPanel) chartPanel).isMouseZoomable() : chartPanel.isRangeZoomable() && chartPanel.isDomainZoomable(); }
Example 3
Source File: ChartLogics.java From old-mzmine3 with GNU General Public License v2.0 | 2 votes |
/** * * @param chartPanel * @return */ public static boolean isMouseZoomable(ChartPanel chartPanel) { return chartPanel instanceof EChartPanel ? ((EChartPanel) chartPanel).isMouseZoomable() : chartPanel.isRangeZoomable() && chartPanel.isDomainZoomable(); }
Example 4
Source File: ChartLogics.java From mzmine2 with GNU General Public License v2.0 | 2 votes |
/** * * @param chartPanel * @return */ public static boolean isMouseZoomable(ChartPanel chartPanel) { return chartPanel instanceof EChartPanel ? ((EChartPanel) chartPanel).isMouseZoomable() : chartPanel.isRangeZoomable() && chartPanel.isDomainZoomable(); }