Example usage for org.jfree.chart.plot Pannable isRangePannable

List of usage examples for org.jfree.chart.plot Pannable isRangePannable

Introduction

In this page you can find the example usage for org.jfree.chart.plot Pannable isRangePannable.

Prototype

public boolean isRangePannable();

Source Link

Document

Evaluates if the range axis can be panned.

Usage

From source file:de.hs.mannheim.modUro.controller.diagram.fx.interaction.PanHandlerFX.java

/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.//from   w  ww. ja va 2  s. c  o m
 * 
 * @param canvas  the JavaFX canvas (<code>null</code> not permitted).
 * @param e  the mouse event (<code>null</code> not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Plot plot = canvas.getChart().getPlot();
    if (!(plot instanceof Pannable)) {
        canvas.clearLiveHandler();
        return;
    }
    Pannable pannable = (Pannable) plot;
    if (pannable.isDomainPannable() || pannable.isRangePannable()) {
        Point2D point = new Point2D.Double(e.getX(), e.getY());
        Rectangle2D dataArea = canvas.findDataArea(point);
        if (dataArea != null && dataArea.contains(point)) {
            this.panW = dataArea.getWidth();
            this.panH = dataArea.getHeight();
            this.panLast = point;
            canvas.setCursor(javafx.scene.Cursor.MOVE);
        }
    }
    // the actual panning occurs later in the mouseDragged() method
}