Java Code Examples for org.jfree.chart.ChartRenderingInfo#getPlotInfo()

The following examples show how to use org.jfree.chart.ChartRenderingInfo#getPlotInfo() . 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: ScrollHandlerFX.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
Example 2
Source File: TaScrollHandlerFX.java    From TAcharting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(TaChartCanvas canvas, Zoomable zoomable,
                            ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's org.sjwimmer.tacharting.data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (canvas.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (canvas.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    }
}
 
Example 3
Source File: ScrollHandlerFX.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
Example 4
Source File: ScrollHandlerFX.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
Example 5
Source File: ScrollHandlerFX.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
Example 6
Source File: ScrollHandlerFX.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
Example 7
Source File: ScrollHandlerFX.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (true) { //this.chartPanel.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (true) { //this.chartPanel.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}
 
Example 8
Source File: ScrollHandlerFX.java    From jfreechart-fx with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Handle the case where a plot implements the {@link Zoomable} interface.
 *
 * @param canvas  the chart canvas.
 * @param zoomable  the zoomable plot.
 * @param e  the mouse wheel event.
 */
private void handleZoomable(ChartCanvas canvas, Zoomable zoomable, 
        ScrollEvent e) {
	if (canvas.getChart() == null) {
	    return;
	}
    // don't zoom unless the mouse pointer is in the plot's data area
    ChartRenderingInfo info = canvas.getRenderingInfo();
    PlotRenderingInfo pinfo = info.getPlotInfo();
    Point2D p = new Point2D.Double(e.getX(), e.getY());
    if (pinfo.getDataArea().contains(p)) {
        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
        boolean notifyState = plot.isNotify();
        plot.setNotify(false);
        int clicks = (int) e.getDeltaY();
        double zf = 1.0 + this.zoomFactor;
        if (clicks < 0) {
            zf = 1.0 / zf;
        }
        if (canvas.isDomainZoomable()) {
            zoomable.zoomDomainAxes(zf, pinfo, p, true);
        }
        if (canvas.isRangeZoomable()) {
            zoomable.zoomRangeAxes(zf, pinfo, p, true);
        }
        plot.setNotify(notifyState);  // this generates the change event too
    } 
}