Java Code Examples for org.jfree.chart.plot.Pannable#panDomainAxes()
The following examples show how to use
org.jfree.chart.plot.Pannable#panDomainAxes() .
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: PanHandlerFX.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Handles a mouse dragged event by calculating the distance panned and * updating the axes accordingly. * * @param canvas the JavaFX canvas (<code>null</code> not permitted). * @param e the mouse event (<code>null</code> not permitted). */ public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) { if (this.panLast == null) { //handle panning if we have a start point else unregister canvas.clearLiveHandler(); return; } JFreeChart chart = canvas.getChart(); double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo(); if (p.getOrientation().isVertical()) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = new Point2D.Double(e.getX(), e.getY()); chart.getPlot().setNotify(old); }
Example 2
Source File: PanHandlerFX.java From jfreechart-fx with GNU Lesser General Public License v2.1 | 5 votes |
/** * Handles a mouse dragged event by calculating the distance panned and * updating the axes accordingly. * * @param canvas the JavaFX canvas ({@code null} not permitted). * @param e the mouse event ({@code null} not permitted). */ @Override public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) { if (this.panLast == null) { //handle panning if we have a start point else unregister canvas.clearLiveHandler(); return; } JFreeChart chart = canvas.getChart(); if (chart == null) { return; } double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo(); if (p.getOrientation().isVertical()) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = new Point2D.Double(e.getX(), e.getY()); chart.getPlot().setNotify(old); }
Example 3
Source File: TaPanHandlerFX.java From TAcharting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Handles a mouse dragged event by calculating the distance panned and * updating the axes accordingly. * * @param canvas the JavaFX canvas ({@code null} not permitted). * @param e the mouse event ({@code null} not permitted). */ @Override public void handleMouseDragged(TaChartCanvas canvas, MouseEvent e) { if (this.panLast == null) { //handle panning if we have a start point else unregister canvas.clearLiveHandler(); return; } JFreeChart chart = canvas.getChart(); double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo(); if (p.getOrientation().isVertical()) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = new Point2D.Double(e.getX(), e.getY()); chart.getPlot().setNotify(old); }
Example 4
Source File: PanHandlerFX.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Handles a mouse dragged event by calculating the distance panned and * updating the axes accordingly. * * @param canvas the JavaFX canvas (<code>null</code> not permitted). * @param e the mouse event (<code>null</code> not permitted). */ public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) { if (this.panLast == null) { //handle panning if we have a start point else unregister canvas.clearLiveHandler(); return; } JFreeChart chart = canvas.getChart(); double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo(); if (p.getOrientation().isVertical()) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = new Point2D.Double(e.getX(), e.getY()); chart.getPlot().setNotify(old); }
Example 5
Source File: PanHandlerFX.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Handles a mouse dragged event by calculating the distance panned and * updating the axes accordingly. * * @param canvas the JavaFX canvas (<code>null</code> not permitted). * @param e the mouse event (<code>null</code> not permitted). */ public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) { if (this.panLast == null) { //handle panning if we have a start point else unregister canvas.clearLiveHandler(); return; } JFreeChart chart = canvas.getChart(); double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo(); if (p.getOrientation().isVertical()) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = new Point2D.Double(e.getX(), e.getY()); chart.getPlot().setNotify(old); }
Example 6
Source File: PanHandlerFX.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Handles a mouse dragged event by calculating the distance panned and * updating the axes accordingly. * * @param canvas the JavaFX canvas (<code>null</code> not permitted). * @param e the mouse event (<code>null</code> not permitted). */ public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) { if (this.panLast == null) { //handle panning if we have a start point else unregister canvas.clearLiveHandler(); return; } JFreeChart chart = canvas.getChart(); double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo(); if (p.getOrientation().isVertical()) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = new Point2D.Double(e.getX(), e.getY()); chart.getPlot().setNotify(old); }
Example 7
Source File: PanHandler.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Handles a mouse dragged event. This is where the panning occurs. * * @param e the event. */ public void mouseDragged(MouseEvent e) { // handle panning if we have a start point if (this.panLast == null) { return; } ChartPanel panel = (ChartPanel) e.getSource(); JFreeChart chart = panel.getChart(); double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = panel.getChartRenderingInfo().getPlotInfo(); if (p.getOrientation() == PlotOrientation.VERTICAL) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = e.getPoint(); chart.getPlot().setNotify(old); return; }
Example 8
Source File: PanHandlerFX.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Handles a mouse dragged event by calculating the distance panned and * updating the axes accordingly. * * @param canvas the JavaFX canvas (<code>null</code> not permitted). * @param e the mouse event (<code>null</code> not permitted). */ public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) { if (this.panLast == null) { //handle panning if we have a start point else unregister canvas.clearLiveHandler(); return; } JFreeChart chart = canvas.getChart(); double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo(); if (p.getOrientation().isVertical()) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = new Point2D.Double(e.getX(), e.getY()); chart.getPlot().setNotify(old); }
Example 9
Source File: PanHandlerFX.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Handles a mouse dragged event by calculating the distance panned and * updating the axes accordingly. * * @param canvas the JavaFX canvas (<code>null</code> not permitted). * @param e the mouse event (<code>null</code> not permitted). */ public void handleMouseDragged(ChartCanvas canvas, MouseEvent e) { if (this.panLast == null) { //handle panning if we have a start point else unregister canvas.clearLiveHandler(); return; } JFreeChart chart = canvas.getChart(); double dx = e.getX() - this.panLast.getX(); double dy = e.getY() - this.panLast.getY(); if (dx == 0.0 && dy == 0.0) { return; } double wPercent = -dx / this.panW; double hPercent = dy / this.panH; boolean old = chart.getPlot().isNotify(); chart.getPlot().setNotify(false); Pannable p = (Pannable) chart.getPlot(); PlotRenderingInfo info = canvas.getRenderingInfo().getPlotInfo(); if (p.getOrientation().isVertical()) { p.panDomainAxes(wPercent, info, this.panLast); p.panRangeAxes(hPercent, info, this.panLast); } else { p.panDomainAxes(hPercent, info, this.panLast); p.panRangeAxes(wPercent, info, this.panLast); } this.panLast = new Point2D.Double(e.getX(), e.getY()); chart.getPlot().setNotify(old); }