Examples of PlotRenderingInfo


Examples of org.jfree.chart.plot.PlotRenderingInfo

      } else if (zoomType == ZoomType.ZOOM_OUT) {
        factor = 1 + zoomDelta;
      }

      // Zoom in on the specified point.
      PlotRenderingInfo plotInfo = chartPanel.getChartRenderingInfo()
          .getPlotInfo();

      Point2D sourcePoint = null;

      sourcePoint = lastPointClicked;
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

  // Returns a pan request listener.
  protected Listener<PanRequestMessage> createPanRequestListener() {
    return new Listener<PanRequestMessage>() {
      @Override
      public void update(PanRequestMessage msg) {
        final PlotRenderingInfo plotInfo = chartPanel
            .getChartRenderingInfo().getPlotInfo();

        final Point2D source = new Point2D.Double(0, 0);

        double percentage = 0.01;
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

    /**
     * Test the equals() method.
     */
    public void testEquals() {
        PlotRenderingInfo p1 = new PlotRenderingInfo(new ChartRenderingInfo());
        PlotRenderingInfo p2 = new PlotRenderingInfo(new ChartRenderingInfo());
        assertTrue(p1.equals(p2));
        assertTrue(p2.equals(p1));

        p1.setPlotArea(new Rectangle(2, 3, 4, 5));
        assertFalse(p1.equals(p2));
        p2.setPlotArea(new Rectangle(2, 3, 4, 5));
        assertTrue(p1.equals(p2));

        p1.setDataArea(new Rectangle(2, 4, 6, 8));
        assertFalse(p1.equals(p2));
        p2.setDataArea(new Rectangle(2, 4, 6, 8));
        assertTrue(p1.equals(p2));

        p1.addSubplotInfo(new PlotRenderingInfo(null));
        assertFalse(p1.equals(p2));
        p2.addSubplotInfo(new PlotRenderingInfo(null));
        assertTrue(p1.equals(p2));

        p1.getSubplotInfo(0).setDataArea(new Rectangle(1, 2, 3, 4));
        assertFalse(p1.equals(p2));
        p2.getSubplotInfo(0).setDataArea(new Rectangle(1, 2, 3, 4));
        assertTrue(p1.equals(p2));
    }
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        PlotRenderingInfo p1 = new PlotRenderingInfo(new ChartRenderingInfo());
        p1.setPlotArea(new Rectangle2D.Double());
        PlotRenderingInfo p2 = null;
        try {
            p2 = (PlotRenderingInfo) p1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(p1 != p2);
        assertTrue(p1.getClass() == p2.getClass());
        assertTrue(p1.equals(p2));

        // check independence
        p1.getPlotArea().setRect(1.0, 2.0, 3.0, 4.0);
        assertFalse(p1.equals(p2));
        p2.getPlotArea().setRect(1.0, 2.0, 3.0, 4.0);
        assertTrue(p1.equals(p2));

        p1.getDataArea().setRect(4.0, 3.0, 2.0, 1.0);
        assertFalse(p1.equals(p2));
        p2.getDataArea().setRect(4.0, 3.0, 2.0, 1.0);
        assertTrue(p1.equals(p2));
    }
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        PlotRenderingInfo p1 = new PlotRenderingInfo(new ChartRenderingInfo());
        PlotRenderingInfo p2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(p1);
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

        // 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)) {
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

     * @param y  the y-coordinate (for subplot selection).
     *
     * @return The scaled data area.
     */
    public Rectangle getScreenDataArea(int x, int y) {
        PlotRenderingInfo plotInfo = this.info.getPlotInfo();
        Rectangle result;
        if (plotInfo.getSubplotCount() == 0)
            result = getScreenDataArea();
        else {
            // 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(x, y));
            int subplotIndex = plotInfo.getSubplotIndex(selectOrigin);
            if (subplotIndex == -1) {
                return null;
            }
            result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea());
        }
        return result;
    }
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

        // 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())
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

     * @param y  the y-coordinate (for subplot selection).
     *
     * @return The scaled data area.
     */
    public Rectangle2D getScreenDataArea(int x, int y) {
        PlotRenderingInfo plotInfo = this.info.getPlotInfo();
        Rectangle2D result;
        if (plotInfo.getSubplotCount() == 0) {
            result = getScreenDataArea();
        }
        else {
            // 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(x, y));
            int subplotIndex = plotInfo.getSubplotIndex(selectOrigin);
            if (subplotIndex == -1) {
                return null;
            }
            result = scale(plotInfo.getSubplotInfo(subplotIndex).getDataArea());
        }
        return result;
    }
View Full Code Here

Examples of org.jfree.chart.plot.PlotRenderingInfo

     * @param e  the mouse wheel event.
     */
    private void handleZoomable(Zoomable zoomable, MouseWheelEvent e) {
        // don't zoom unless the mouse pointer is in the plot's data area
        ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
        PlotRenderingInfo pinfo = info.getPlotInfo();
        Point2D p = this.chartPanel.translateScreenToJava2D(e.getPoint());
        if (!pinfo.getDataArea().contains(p)) {
            return;
        }

        Plot plot = (Plot) zoomable;
        // do not notify while zooming each axis
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.