Java Code Examples for org.jfree.chart.plot.Zoomable#getOrientation()

The following examples show how to use org.jfree.chart.plot.Zoomable#getOrientation() . 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: ChartPanel.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Receives notification of changes to the chart, and redraws the chart.
 *
 * @param event  details of the chart change event.
 */
@Override
public void chartChanged(ChartChangeEvent event) {
    this.refreshBuffer = true;
    Plot plot = this.chart.getPlot();
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        this.orientation = z.getOrientation();
    }
    repaint();
}
 
Example 2
Source File: AbstractChartPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Receives notification of changes to the chart, and redraws the chart.
 * 
 * @param event
 *            details of the chart change event.
 */

@Override
public void chartChanged(ChartChangeEvent event) {
	Plot plot = this.chart.getPlot();
	if (plot instanceof Zoomable) {
		Zoomable z = (Zoomable) plot;
		this.orientation = z.getOrientation();
	}
	repaint();
}
 
Example 3
Source File: AbstractChartPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 * 
 * @param chart
 *            the chart (<code>null</code> permitted).
 */

@Override
public void setChart(JFreeChart chart) {

	// stop listening for changes to the existing chart
	if (this.chart != null) {
		this.chart.removeChangeListener(this);
		this.chart.removeProgressListener(this);
	}

	// add the new chart
	this.chart = chart;
	if (chart != null) {
		this.chart.addChangeListener(this);
		this.chart.addProgressListener(this);
		Plot plot = chart.getPlot();
		this.domainZoomable = false;
		this.rangeZoomable = false;
		if (plot instanceof Zoomable) {
			Zoomable z = (Zoomable) plot;
			this.domainZoomable = z.isDomainZoomable();
			this.rangeZoomable = z.isRangeZoomable();
			this.orientation = z.getOrientation();
		}
	} else {
		this.domainZoomable = false;
		this.rangeZoomable = false;
	}

	repaint();

}
 
Example 4
Source File: ChartPanel.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Receives notification of changes to the chart, and redraws the chart.
 *
 * @param event  details of the chart change event.
 */
@Override
public void chartChanged(ChartChangeEvent event) {
    this.refreshBuffer = true;
    Plot plot = this.chart.getPlot();
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        this.orientation = z.getOrientation();
    }
    repaint();
}
 
Example 5
Source File: ChartPanel.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {

    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
    repaint();

}
 
Example 6
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Receives notification of changes to the chart, and redraws the chart.
 *
 * @param event  details of the chart change event.
 */
public void chartChanged(ChartChangeEvent event) {
    this.refreshBuffer = true;
    Plot plot = this.chart.getPlot();
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        this.orientation = z.getOrientation();
    }
    this.canvas.redraw();
}
 
Example 7
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Zooms in on a selected region.
 *
 * @param selection  the selected region.
 */
public void zoom(Rectangle selection) {

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(
            new Point(selection.x, selection.y));
    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    Rectangle scaledDataArea = getScreenDataArea(
            (selection.x + selection.width / 2),
            (selection.y + selection.height / 2));
    if ((selection.height > 0) && (selection.width > 0)) {

        double hLower = (selection.x - scaledDataArea.x)
            / (double) scaledDataArea.width;
        double hUpper = (selection.x + selection.width - scaledDataArea.x)
            / (double) scaledDataArea.width;
        double vLower = (scaledDataArea.y + scaledDataArea.height
                - selection.y - selection.height)
                / (double) scaledDataArea.height;
        double vUpper = (scaledDataArea.y + scaledDataArea.height
                - selection.y) / (double) scaledDataArea.height;
        Plot p = this.chart.getPlot();
        if (p instanceof Zoomable) {
            Zoomable z = (Zoomable) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
            }
            else {
                z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
            }
        }

    }

}
 
Example 8
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {
    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
}
 
Example 9
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {
    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
}
 
Example 10
Source File: ChartPanel.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {

    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
    repaint();

}
 
Example 11
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Receives notification of changes to the chart, and redraws the chart.
 *
 * @param event  details of the chart change event.
 */
public void chartChanged(ChartChangeEvent event) {
    this.refreshBuffer = true;
    Plot plot = this.chart.getPlot();
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        this.orientation = z.getOrientation();
    }
    this.canvas.redraw();
}
 
Example 12
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Zooms in on a selected region.
 *
 * @param selection  the selected region.
 */
public void zoom(Rectangle selection) {

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(
            new Point(selection.x, selection.y));
    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    Rectangle scaledDataArea = getScreenDataArea(
            (selection.x + selection.width / 2),
            (selection.y + selection.height / 2));
    if ((selection.height > 0) && (selection.width > 0)) {

        double hLower = (selection.x - scaledDataArea.x)
            / (double) scaledDataArea.width;
        double hUpper = (selection.x + selection.width - scaledDataArea.x)
            / (double) scaledDataArea.width;
        double vLower = (scaledDataArea.y + scaledDataArea.height
                - selection.y - selection.height)
                / (double) scaledDataArea.height;
        double vUpper = (scaledDataArea.y + scaledDataArea.height
                - selection.y) / (double) scaledDataArea.height;
        Plot p = this.chart.getPlot();
        if (p instanceof Zoomable) {
            Zoomable z = (Zoomable) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
            }
            else {
                z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
            }
        }

    }

}
 
Example 13
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {
    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
}
 
Example 14
Source File: ChartPanel.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Receives notification of changes to the chart, and redraws the chart.
 *
 * @param event  details of the chart change event.
 */
@Override
public void chartChanged(ChartChangeEvent event) {
    this.refreshBuffer = true;
    Plot plot = this.chart.getPlot();
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        this.orientation = z.getOrientation();
    }
    repaint();
}
 
Example 15
Source File: ChartPanel.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {

    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
    repaint();

}
 
Example 16
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Receives notification of changes to the chart, and redraws the chart.
 *
 * @param event  details of the chart change event.
 */
public void chartChanged(ChartChangeEvent event) {
    this.refreshBuffer = true;
    Plot plot = this.chart.getPlot();
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        this.orientation = z.getOrientation();
    }
    this.canvas.redraw();
}
 
Example 17
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Zooms in on a selected region.
 *
 * @param selection  the selected region.
 */
public void zoom(Rectangle selection) {

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(
            new Point(selection.x, selection.y));
    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    Rectangle scaledDataArea = getScreenDataArea(
            (selection.x + selection.width / 2),
            (selection.y + selection.height / 2));
    if ((selection.height > 0) && (selection.width > 0)) {

        double hLower = (selection.x - scaledDataArea.x)
            / (double) scaledDataArea.width;
        double hUpper = (selection.x + selection.width - scaledDataArea.x)
            / (double) scaledDataArea.width;
        double vLower = (scaledDataArea.y + scaledDataArea.height
                - selection.y - selection.height)
                / (double) scaledDataArea.height;
        double vUpper = (scaledDataArea.y + scaledDataArea.height
                - selection.y) / (double) scaledDataArea.height;
        Plot p = this.chart.getPlot();
        if (p instanceof Zoomable) {
            Zoomable z = (Zoomable) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
            }
            else {
                z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
            }
        }

    }

}
 
Example 18
Source File: ChartPanel.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Zooms in on a selected region.
 *
 * @param selection  the selected region.
 */
public void zoom(Rectangle2D selection) {

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(new Point(
            (int) Math.ceil(selection.getX()),
            (int) Math.ceil(selection.getY())));
    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    Rectangle2D scaledDataArea = getScreenDataArea(
            (int) selection.getCenterX(), (int) selection.getCenterY());
    if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) {

        double hLower = (selection.getMinX() - scaledDataArea.getMinX())
            / scaledDataArea.getWidth();
        double hUpper = (selection.getMaxX() - scaledDataArea.getMinX())
            / scaledDataArea.getWidth();
        double vLower = (scaledDataArea.getMaxY() - selection.getMaxY())
            / scaledDataArea.getHeight();
        double vUpper = (scaledDataArea.getMaxY() - selection.getMinY())
            / scaledDataArea.getHeight();

        Plot p = this.chart.getPlot();
        if (p instanceof Zoomable) {
            // here we tweak the notify flag on the plot so that only
            // one notification happens even though we update multiple
            // axes...
            boolean savedNotify = p.isNotify();
            p.setNotify(false);
            Zoomable z = (Zoomable) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
            }
            else {
                z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
            }
            p.setNotify(savedNotify);
        }

    }

}
 
Example 19
Source File: ChartPanel.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Zooms in on a selected region.
 *
 * @param selection  the selected region.
 */
public void zoom(Rectangle2D selection) {

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(new Point(
            (int) Math.ceil(selection.getX()),
            (int) Math.ceil(selection.getY())));
    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    Rectangle2D scaledDataArea = getScreenDataArea(
            (int) selection.getCenterX(), (int) selection.getCenterY());
    if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) {

        double hLower = (selection.getMinX() - scaledDataArea.getMinX())
            / scaledDataArea.getWidth();
        double hUpper = (selection.getMaxX() - scaledDataArea.getMinX())
            / scaledDataArea.getWidth();
        double vLower = (scaledDataArea.getMaxY() - selection.getMaxY())
            / scaledDataArea.getHeight();
        double vUpper = (scaledDataArea.getMaxY() - selection.getMinY())
            / scaledDataArea.getHeight();

        Plot p = this.chart.getPlot();
        if (p instanceof Zoomable) {
            // here we tweak the notify flag on the plot so that only
            // one notification happens even though we update multiple
            // axes...
            boolean savedNotify = p.isNotify();
            p.setNotify(false);
            Zoomable z = (Zoomable) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
            }
            else {
                z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
            }
            p.setNotify(savedNotify);
        }

    }

}
 
Example 20
Source File: ChartPanel.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Zooms in on a selected region.
 *
 * @param selection  the selected region.
 */
public void zoom(Rectangle2D selection) {

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(new Point(
            (int) Math.ceil(selection.getX()),
            (int) Math.ceil(selection.getY())));
    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    Rectangle2D scaledDataArea = getScreenDataArea(
            (int) selection.getCenterX(), (int) selection.getCenterY());
    if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) {

        double hLower = (selection.getMinX() - scaledDataArea.getMinX())
            / scaledDataArea.getWidth();
        double hUpper = (selection.getMaxX() - scaledDataArea.getMinX())
            / scaledDataArea.getWidth();
        double vLower = (scaledDataArea.getMaxY() - selection.getMaxY())
            / scaledDataArea.getHeight();
        double vUpper = (scaledDataArea.getMaxY() - selection.getMinY())
            / scaledDataArea.getHeight();

        Plot p = this.chart.getPlot();
        if (p instanceof Zoomable) {
            // here we tweak the notify flag on the plot so that only
            // one notification happens even though we update multiple
            // axes...
            boolean savedNotify = p.isNotify();
            p.setNotify(false);
            Zoomable z = (Zoomable) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
            }
            else {
                z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
            }
            p.setNotify(savedNotify);
        }

    }

}