Package org.jfree.chart.axis

Examples of org.jfree.chart.axis.AxisState


    /**
     * Checks that a TickUnit with a size of 0 doesn't crash.
     */
    public void testrefreshTicksWithZeroTickUnit() {
        LogAxis axis = new LogAxis();
        AxisState state = new AxisState();
        BufferedImage image = new BufferedImage(200, 100,
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, 200, 100);
        axis.refreshTicks(g2, state, area, RectangleEdge.TOP);
View Full Code Here


        // draw the shared axis
        ValueAxis axis = getDomainAxis();
        RectangleEdge edge = getDomainAxisEdge();
        double cursor = RectangleEdge.coordinate(dataArea, edge);
        AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);
        if (parentState == null) {
            parentState = new PlotState();
        }
        parentState.getSharedAxisStates().put(axis, axisState);
View Full Code Here

        // draw the shared axis
        CategoryAxis axis = getDomainAxis();
        RectangleEdge domainEdge = getDomainAxisEdge();
        double cursor = RectangleEdge.coordinate(dataArea, domainEdge);
        AxisState axisState = axis.draw(g2, cursor, area, dataArea,
                domainEdge, info);
        if (parentState == null) {
            parentState = new PlotState();
        }
        parentState.getSharedAxisStates().put(axis, axisState);
View Full Code Here

        BufferedImage image = new BufferedImage(200, 100,
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, 200, 100);
        axis.setTickMarkPosition(DateTickMarkPosition.END);
        List ticks = axis.refreshTicks(g2, new AxisState(), area,
                RectangleEdge.BOTTOM);
        assertEquals(3, ticks.size());
        DateTick t1 = (DateTick) ticks.get(0);
        assertEquals("31-Mar-2008", t1.getText());
        DateTick t2 = (DateTick) ticks.get(1);
        assertEquals("30-Apr-2008", t2.getText());
        DateTick t3 = (DateTick) ticks.get(2);
        assertEquals("31-May-2008", t3.getText());

        // now repeat for a vertical axis
        ticks = axis.refreshTicks(g2, new AxisState(), area,
                RectangleEdge.LEFT);
        assertEquals(3, ticks.size());
        t1 = (DateTick) ticks.get(0);
        assertEquals("31-Mar-2008", t1.getText());
        t2 = (DateTick) ticks.get(1);
View Full Code Here

    /**
     * Checks that a TickUnit with a size of 0 doesn't crash.
     */
    public void testrefreshTicksWithZeroTickUnit() {
        LogAxis axis = new LogAxis();
        AxisState state = new AxisState();
        BufferedImage image = new BufferedImage(200, 100,
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, 200, 100);
        axis.refreshTicks(g2, state, area, RectangleEdge.TOP);
View Full Code Here

        BufferedImage image = new BufferedImage(200, 100,
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, 200, 100);
        axis.setTickMarkPosition(DateTickMarkPosition.END);
        List ticks = axis.refreshTicks(g2, new AxisState(), area,
                RectangleEdge.BOTTOM);
        assertEquals(3, ticks.size());
        DateTick t1 = (DateTick) ticks.get(0);
        assertEquals("31-Mar-2008", t1.getText());
        DateTick t2 = (DateTick) ticks.get(1);
        assertEquals("30-Apr-2008", t2.getText());
        DateTick t3 = (DateTick) ticks.get(2);
        assertEquals("31-May-2008", t3.getText());

        // now repeat for a vertical axis
        ticks = axis.refreshTicks(g2, new AxisState(), area,
                RectangleEdge.LEFT);
        assertEquals(3, ticks.size());
        t1 = (DateTick) ticks.get(0);
        assertEquals("31-Mar-2008", t1.getText());
        t2 = (DateTick) ticks.get(1);
View Full Code Here

                BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, 500, 200);

        // if the bug is still present, this leads to an endless loop
        axis.refreshTicks(g2, new AxisState(), area, RectangleEdge.BOTTOM);
    }
View Full Code Here

      g2.clip(dataArea);
      g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
              getForegroundAlpha()));

      AxisState domainAxisState = (AxisState) axisStateMap.get(
              getDomainAxis());

      if (domainAxisState == null)
      {
         if (parentState != null)
         {
            domainAxisState = (AxisState) parentState.getSharedAxisStates().get(getDomainAxis());
         }
      }

      AxisState rangeAxisState = (AxisState) axisStateMap.get(getRangeAxis());
      if (rangeAxisState == null)
      {
         if (parentState != null)
         {
            rangeAxisState = (AxisState) parentState.getSharedAxisStates().get(getRangeAxis());
         }
      }
      if (domainAxisState != null)
      {
         drawDomainTickBands(g2, dataArea, domainAxisState.getTicks());
      }
      if (rangeAxisState != null)
      {
         drawRangeTickBands(g2, dataArea, rangeAxisState.getTicks());
      }
      if (domainAxisState != null)
      {
         drawDomainGridlines(g2, dataArea, domainAxisState.getTicks());
         drawZeroDomainBaseline(g2, dataArea);
      }
      if (rangeAxisState != null)
      {
         drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks());
         drawZeroRangeBaseline(g2, dataArea);
      }

      Graphics2D savedG2 = g2;
      BufferedImage dataImage = null;
View Full Code Here

      while (iterator.hasNext())
      {
         ValueAxis axis = (ValueAxis) iterator.next();

         AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
                 RectangleEdge.TOP, plotState);

         cursor = info.getCursor();
         axisStateMap.put(axis, info);
      }

      // draw the bottom axes
      cursor = dataArea.getMaxY()
              + this.axisOffset.calculateBottomOutset(dataArea.getHeight());

      iterator = axisCollection.getAxesAtBottom().iterator();

      while (iterator.hasNext())
      {
         ValueAxis axis = (ValueAxis) iterator.next();

         AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
                 RectangleEdge.BOTTOM, plotState);

         cursor = info.getCursor();
         axisStateMap.put(axis, info);
      }

      // draw the left axes
      cursor = dataArea.getMinX()
              - this.axisOffset.calculateLeftOutset(dataArea.getWidth());

      iterator = axisCollection.getAxesAtLeft().iterator();


      while (iterator.hasNext())
      {
         ValueAxis axis = (ValueAxis) iterator.next();

         AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
                 RectangleEdge.LEFT, plotState);

         cursor = info.getCursor();
         axisStateMap.put(axis, info);
      }

      // draw the right axes
      cursor = dataArea.getMaxX()
              + this.axisOffset.calculateRightOutset(dataArea.getWidth());

      iterator = axisCollection.getAxesAtRight().iterator();

      while (iterator.hasNext())
      {
         ValueAxis axis = (ValueAxis) iterator.next();
         AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
                 RectangleEdge.RIGHT, plotState);
         cursor = info.getCursor();
         axisStateMap.put(axis, info);
      }

      return axisStateMap;
   }
View Full Code Here

        // draw the shared axis
        CategoryAxis axis = getDomainAxis();
        RectangleEdge domainEdge = getDomainAxisEdge();
        double cursor = RectangleEdge.coordinate(dataArea, domainEdge);
        AxisState axisState = axis.draw(g2, cursor, area, dataArea,
                domainEdge, info);
        if (parentState == null) {
            parentState = new PlotState();
        }
        parentState.getSharedAxisStates().put(axis, axisState);
View Full Code Here

TOP

Related Classes of org.jfree.chart.axis.AxisState

Copyright © 2018 www.massapicom. 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.