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

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

Introduction

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

Prototype

public boolean isDomainPannable();

Source Link

Document

Evaluates if the domain 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./*w ww  .j av  a  2s. 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
}