Package org.jfree.chart.axis

Examples of org.jfree.chart.axis.Axis


                        domainEdge, space);
            }

            // reserve space for any domain axes...
            for (int i = 0; i < this.domainAxes.size(); i++) {
                Axis xAxis = (Axis) this.domainAxes.get(i);
                if (xAxis != null) {
                    RectangleEdge edge = getDomainAxisEdge(i);
                    space = xAxis.reserveSpace(g2, this, plotArea, edge, space);
                }
            }
        }

        return space;
View Full Code Here


            }
        }
        else {
            // reserve space for the range axes (if any)...
            for (int i = 0; i < this.rangeAxes.size(); i++) {
                Axis yAxis = (Axis) this.rangeAxes.get(i);
                if (yAxis != null) {
                    RectangleEdge edge = getRangeAxisEdge(i);
                    space = yAxis.reserveSpace(g2, this, plotArea, edge, space);
                }
            }
        }
        return space;
View Full Code Here

        // draw the top axes
        double cursor = dataArea.getMinY() - this.axisOffset.calculateTopOutset(
                dataArea.getHeight());
        Iterator iterator = axisCollection.getAxesAtTop().iterator();
        while (iterator.hasNext()) {
            Axis axis = (Axis) iterator.next();
            if (axis != null) {
                AxisState axisState = axis.draw(g2, cursor, plotArea, dataArea,
                        RectangleEdge.TOP, plotState);
                cursor = axisState.getCursor();
                axisStateMap.put(axis, axisState);
            }
        }

        // draw the bottom axes
        cursor = dataArea.getMaxY()
                 + this.axisOffset.calculateBottomOutset(dataArea.getHeight());
        iterator = axisCollection.getAxesAtBottom().iterator();
        while (iterator.hasNext()) {
            Axis axis = (Axis) iterator.next();
            if (axis != null) {
                AxisState axisState = axis.draw(g2, cursor, plotArea, dataArea,
                        RectangleEdge.BOTTOM, plotState);
                cursor = axisState.getCursor();
                axisStateMap.put(axis, axisState);
            }
        }

        // draw the left axes
        cursor = dataArea.getMinX()
                 - this.axisOffset.calculateLeftOutset(dataArea.getWidth());
        iterator = axisCollection.getAxesAtLeft().iterator();
        while (iterator.hasNext()) {
            Axis axis = (Axis) iterator.next();
            if (axis != null) {
                AxisState axisState = axis.draw(g2, cursor, plotArea, dataArea,
                        RectangleEdge.LEFT, plotState);
                cursor = axisState.getCursor();
                axisStateMap.put(axis, axisState);
            }
        }

        // draw the right axes
        cursor = dataArea.getMaxX()
                 + this.axisOffset.calculateRightOutset(dataArea.getWidth());
        iterator = axisCollection.getAxesAtRight().iterator();
        while (iterator.hasNext()) {
            Axis axis = (Axis) iterator.next();
            if (axis != null) {
                AxisState axisState = axis.draw(g2, cursor, plotArea, dataArea,
                        RectangleEdge.RIGHT, plotState);
                cursor = axisState.getCursor();
                axisStateMap.put(axis, axisState);
            }
        }
View Full Code Here

      else
      {
         // reserve space for the domain axes...
         for (int i = 0; i < super.getDomainAxes().size(); i++)
         {
            Axis axisCur = (Axis) super.getDomainAxes().get(i);

            if (axisCur != null)
            {
               RectangleEdge edge = getDomainAxisEdge(i);
               space = axisCur.reserveSpace(g2, this, plotArea, edge, space);
            }
         }


         /*ValueAxis xAxis = getDomainAxis();
View Full Code Here

        this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
        this.angleLabelPaint = SerialUtilities.readPaint(stream);

        int rangeAxisCount = this.axes.size();
        for (int i = 0; i < rangeAxisCount; i++) {
            Axis axis = (Axis) this.axes.get(i);
            if (axis != null) {
                axis.setPlot(this);
                axis.addChangeListener(this);
            }
        }
        int datasetCount = this.datasets.size();
        for (int i = 0; i < datasetCount; i++) {
            Dataset dataset = (Dataset) this.datasets.get(i);
View Full Code Here

            } catch (Exception lfe) {}
        }



        Axis xAxis = getHorizontalAxis(chart);
        if (xAxis != null) {
            if (parameters.get("hideTickLabels") != null||
                parameters.get("hideXTickLabels") != null) {
                xAxis.setTickLabelsVisible(false);
            } else if (parameters.get("tickLabelFontSize") != null ||
                       parameters.get("xTickLabelFontSize") != null) {
                String tfs = getParameter("xTickLabelFontSize");
                if (tfs == null) tfs = getParameter("tickLabelFontSize");
                float fontSize = Float.parseFloat(tfs);
                xAxis.setTickLabelFont
                    (xAxis.getTickLabelFont().deriveFont(fontSize));
            }
        }

        Axis yAxis = getVerticalAxis(chart);
        if (yAxis != null) {
            if (parameters.get("hideTickLabels") != null||
                parameters.get("hideYTickLabels") != null) {
                yAxis.setTickLabelsVisible(false);
            } else if (parameters.get("tickLabelFontSize") != null ||
                       parameters.get("yTickLabelFontSize") != null) {
                String tfs = getParameter("yTickLabelFontSize");
                if (tfs == null) tfs = getParameter("tickLabelFontSize");
                float fontSize = Float.parseFloat(tfs);
                yAxis.setTickLabelFont
                    (yAxis.getTickLabelFont().deriveFont(fontSize));
            }
        }

        String axisFontSize = getSetting("axisLabelFontSize");
        if (axisFontSize != null) try {
            float fontSize = Float.parseFloat(axisFontSize);
            if (xAxis != null)
                xAxis.setLabelFont(xAxis.getLabelFont().deriveFont(fontSize));
            if (yAxis != null)
                yAxis.setLabelFont(yAxis.getLabelFont().deriveFont(fontSize));
        } catch (Exception afs) {}


        BufferedImage img = new BufferedImage
            (width, height, BufferedImage.TYPE_INT_RGB);
View Full Code Here

            } catch (Exception lfe) {}
        }

        chart.getPlot().setNoDataMessage(resources.getString("No_Data_Message"));

        Axis xAxis = getHorizontalAxis(chart);
        if (xAxis != null) {
            if (parameters.get("hideTickLabels") != null||
                parameters.get("hideXTickLabels") != null) {
                xAxis.setTickLabelsVisible(false);
            } else if (parameters.get("tickLabelFontSize") != null ||
                       parameters.get("xTickLabelFontSize") != null) {
                String tfs = getParameter("xTickLabelFontSize");
                if (tfs == null) tfs = getParameter("tickLabelFontSize");
                float fontSize = Float.parseFloat(tfs);
                xAxis.setTickLabelFont
                    (xAxis.getTickLabelFont().deriveFont(fontSize));
            }
        }

        Axis yAxis = getVerticalAxis(chart);
        if (yAxis != null) {
            if (parameters.get("hideTickLabels") != null||
                parameters.get("hideYTickLabels") != null) {
                yAxis.setTickLabelsVisible(false);
            } else if (parameters.get("tickLabelFontSize") != null ||
                       parameters.get("yTickLabelFontSize") != null) {
                String tfs = getParameter("yTickLabelFontSize");
                if (tfs == null) tfs = getParameter("tickLabelFontSize");
                float fontSize = Float.parseFloat(tfs);
                yAxis.setTickLabelFont
                    (yAxis.getTickLabelFont().deriveFont(fontSize));
            }
        }

        String axisFontSize = getSetting("axisLabelFontSize");
        if (axisFontSize != null) try {
            float fontSize = Float.parseFloat(axisFontSize);
            if (xAxis != null)
                xAxis.setLabelFont(xAxis.getLabelFont().deriveFont(fontSize));
            if (yAxis != null)
                yAxis.setLabelFont(yAxis.getLabelFont().deriveFont(fontSize));
        } catch (Exception afs) {}

        ChartRenderingInfo info =
                (isHtmlMode() ? new ChartRenderingInfo() : null);
        BufferedImage img = new BufferedImage
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {

        Axis a1 = new CategoryAxis("Test");
        Axis a2 = new CategoryAxis("Test");
        assertTrue(a1.equals(a2));

        // visible flag...
        a1.setVisible(false);
        assertFalse(a1.equals(a2));
        a2.setVisible(false);
        assertTrue(a1.equals(a2));

        // label...
        a1.setLabel("New Label");
        assertFalse(a1.equals(a2));
        a2.setLabel("New Label");
        assertTrue(a1.equals(a2));

        // label font...
        a1.setLabelFont(new Font("Dialog", Font.PLAIN, 8));
        assertFalse(a1.equals(a2));
        a2.setLabelFont(new Font("Dialog", Font.PLAIN, 8));
        assertTrue(a1.equals(a2));

        // label paint...
        a1.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.white,
                3.0f, 4.0f, Color.black));
        assertFalse(a1.equals(a2));
        a2.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.white,
                3.0f, 4.0f, Color.black));
        assertTrue(a1.equals(a2));

        // label insets...
        a1.setLabelInsets(new RectangleInsets(10.0, 10.0, 10.0, 10.0));
        assertFalse(a1.equals(a2));
        a2.setLabelInsets(new RectangleInsets(10.0, 10.0, 10.0, 10.0));
        assertTrue(a1.equals(a2));

        // label angle...
        a1.setLabelAngle(1.23);
        assertFalse(a1.equals(a2));
        a2.setLabelAngle(1.23);
        assertTrue(a1.equals(a2));

        // axis line visible...
        a1.setAxisLineVisible(false);
        assertFalse(a1.equals(a2));
        a2.setAxisLineVisible(false);
        assertTrue(a1.equals(a2));

        // axis line stroke...
        BasicStroke s = new BasicStroke(1.1f);
        a1.setAxisLineStroke(s);
        assertFalse(a1.equals(a2));
        a2.setAxisLineStroke(s);
        assertTrue(a1.equals(a2));

        // axis line paint...
        a1.setAxisLinePaint(new GradientPaint(1.0f, 2.0f, Color.red,
                3.0f, 4.0f, Color.black));
        assertFalse(a1.equals(a2));
        a2.setAxisLinePaint(new GradientPaint(1.0f, 2.0f, Color.red,
                3.0f, 4.0f, Color.black));
        assertTrue(a1.equals(a2));

        // tick labels visible flag...
        a1.setTickLabelsVisible(false);
        assertFalse(a1.equals(a2));
        a2.setTickLabelsVisible(false);
        assertTrue(a1.equals(a2));

        // tick label font...
        a1.setTickLabelFont(new Font("Dialog", Font.PLAIN, 12));
        assertFalse(a1.equals(a2));
        a2.setTickLabelFont(new Font("Dialog", Font.PLAIN, 12));
        assertTrue(a1.equals(a2));

        // tick label paint...
        a1.setTickLabelPaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
                3.0f, 4.0f, Color.black));
        assertFalse(a1.equals(a2));
        a2.setTickLabelPaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
                3.0f, 4.0f, Color.black));
        assertTrue(a1.equals(a2));

        // tick label insets...
        a1.setTickLabelInsets(new RectangleInsets(10.0, 10.0, 10.0, 10.0));
        assertFalse(a1.equals(a2));
        a2.setTickLabelInsets(new RectangleInsets(10.0, 10.0, 10.0, 10.0));
        assertTrue(a1.equals(a2));

        // tick marks visible flag...
        a1.setTickMarksVisible(false);
        assertFalse(a1.equals(a2));
        a2.setTickMarksVisible(false);
        assertTrue(a1.equals(a2));

        // tick mark inside length...
        a1.setTickMarkInsideLength(1.23f);
        assertFalse(a1.equals(a2));
        a2.setTickMarkInsideLength(1.23f);
        assertTrue(a1.equals(a2));

        // tick mark outside length...
        a1.setTickMarkOutsideLength(1.23f);
        assertFalse(a1.equals(a2));
        a2.setTickMarkOutsideLength(1.23f);
        assertTrue(a1.equals(a2));

        // tick mark stroke...
        a1.setTickMarkStroke(new BasicStroke(2.0f));
        assertFalse(a1.equals(a2));
        a2.setTickMarkStroke(new BasicStroke(2.0f));
        assertTrue(a1.equals(a2));

        // tick mark paint...
        a1.setTickMarkPaint(new GradientPaint(1.0f, 2.0f, Color.cyan,
                3.0f, 4.0f, Color.black));
        assertFalse(a1.equals(a2));
        a2.setTickMarkPaint(new GradientPaint(1.0f, 2.0f, Color.cyan,
                3.0f, 4.0f, Color.black));
        assertTrue(a1.equals(a2));

        // fixed dimension...
        a1.setFixedDimension(3.21f);
        assertFalse(a1.equals(a2));
        a2.setFixedDimension(3.21f);
        assertTrue(a1.equals(a2));

        a1.setMinorTickMarksVisible(true);
        assertFalse(a1.equals(a2));
        a2.setMinorTickMarksVisible(true);
        assertTrue(a1.equals(a2));

        a1.setMinorTickMarkInsideLength(1.23f);
        assertFalse(a1.equals(a2));
        a2.setMinorTickMarkInsideLength(1.23f);
        assertTrue(a1.equals(a2));

        a1.setMinorTickMarkOutsideLength(3.21f);
        assertFalse(a1.equals(a2));
        a2.setMinorTickMarkOutsideLength(3.21f);
        assertTrue(a1.equals(a2));

    }
View Full Code Here

    /**
     * Two objects that are equal are required to return the same hashCode.
     */
    public void testHashCode() {
        Axis a1 = new CategoryAxis("Test");
        Axis a2 = new CategoryAxis("Test");
        assertTrue(a1.equals(a2));
        int h1 = a1.hashCode();
        int h2 = a2.hashCode();
        assertEquals(h1, h2);
    }
View Full Code Here

        this.radiusGridlinePaint = SerialUtilities.readPaint(stream);
        this.angleLabelPaint = SerialUtilities.readPaint(stream);

        int rangeAxisCount = this.axes.size();
        for (int i = 0; i < rangeAxisCount; i++) {
            Axis axis = (Axis) this.axes.get(i);
            if (axis != null) {
                axis.setPlot(this);
                axis.addChangeListener(this);
            }
        }
        int datasetCount = this.datasets.size();
        for (int i = 0; i < datasetCount; i++) {
            Dataset dataset = (Dataset) this.datasets.get(i);
View Full Code Here

TOP

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

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.