Examples of XYTextAnnotation


Examples of org.jfree.chart.annotations.XYTextAnnotation

        r1.setURLGenerator(new StandardXYURLGenerator());
        assertFalse(r1.equals(r2));
        r2.setURLGenerator(new StandardXYURLGenerator());
        assertTrue(r1.equals(r2));

        r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
        assertFalse(r1.equals(r2));
        r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
        assertTrue(r1.equals(r2));

        r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
        assertFalse(r1.equals(r2));
        r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
        assertTrue(r1.equals(r2));

        r1.setDefaultEntityRadius(99);
        assertFalse(r1.equals(r2));
        r2.setDefaultEntityRadius(99);
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

        r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
        assertFalse(r1.equals(r2));
        r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
        assertTrue(r1.equals(r2));

        r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
                Layer.FOREGROUND);
        assertFalse(r1.equals(r2));
        r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
                Layer.FOREGROUND);
        assertTrue(r1.equals(r2));

        r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
                Layer.BACKGROUND);
        assertFalse(r1.equals(r2));
        r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
                Layer.BACKGROUND);
        assertTrue(r1.equals(r2));

    }
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

            String text = (String) iterator.next();
            String pos = (String)annotationMap.get(text);
            double x = Double.parseDouble(pos.substring(0, pos.indexOf("__")));
            double y = Double.parseDouble(pos.substring(pos.indexOf("__")+2));
            //default up position
            XYTextAnnotation annotation = new XYTextAnnotation(text, y-1, x+((text.length()>20)?text.length()/3+1:text.length()/2+1));
            if (cont % 2 != 0)
              //dx
              annotation = new XYTextAnnotation(text, y, x+((text.length()>20)?text.length()/3+1:text.length()/2+1));
            else
              //sx
              //annotation = new XYTextAnnotation(text, y, x-((text.length()%2==0)?text.length():text.length()-1));
              annotation = new XYTextAnnotation(text, y, x-(text.length()-1));
             
                  annotation.setFont(new Font("SansSerif", Font.PLAIN, 11));
                  //annotation.setRotationAngle(Math.PI / 4.0);
                  annotation.setRotationAngle(0.0); // horizontal
                  plot.addAnnotation(annotation);
                  cont ++;
            }
            renderer.setShape(new Ellipse2D.Double(-3, -5, 8, 8));
          }         
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

//    "P_",1.2308508E12, 16.3);

    for (Iterator iterator = annotations.keySet().iterator(); iterator.hasNext();) {
      String annotationCode = (String) iterator.next();
      AnnotationBlock annotationBlock=annotations.get(annotationCode);
      XYTextAnnotation xyAnnotation = new XYTextAnnotation(
          annotationBlock.getAnnotation(),annotationBlock.getXPosition()+ANNOTATION_HEIGHT, annotationBlock.getYPosition());
      if(styleAnnotation!=null){
        xyAnnotation.setFont(new Font(styleAnnotation.getFontName(),Font.BOLD,styleAnnotation.getSize()));
        xyAnnotation.setPaint(styleAnnotation.getColor());
      }
      else{
        xyAnnotation.setFont(new Font("Nome",Font.BOLD,8));       
        xyAnnotation.setPaint(Color.BLACK);
      }

      xyAnnotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
      renderer.addAnnotation(xyAnnotation);
    }

    logger.debug("Annotation set");
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

        XYItemRenderer renderer1 = new StandardXYItemRenderer();
        NumberAxis rangeAxis1 = new NumberAxis("Range 1");
        XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
        subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

        XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0,
                10000.0);
        annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
        annotation.setRotationAngle(Math.PI / 4.0);
        subplot1.addAnnotation(annotation);

        // create subplot 2...
        XYDataset data2 = createDataset2();
        XYItemRenderer renderer2 = new StandardXYItemRenderer();
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

    /**
     * Some checks for the removeAnnotation() method.
     */
    public void testRemoveAnnotation() {
        XYPlot plot = new XYPlot();
        XYTextAnnotation a1 = new XYTextAnnotation("X", 1.0, 2.0);
        XYTextAnnotation a2 = new XYTextAnnotation("X", 3.0, 4.0);
        XYTextAnnotation a3 = new XYTextAnnotation("X", 1.0, 2.0);
        plot.addAnnotation(a1);
        plot.addAnnotation(a2);
        plot.addAnnotation(a3);
        plot.removeAnnotation(a2);
        XYTextAnnotation x = (XYTextAnnotation) plot.getAnnotations().get(0);
        assertEquals(x, a1);

        // now remove a3, but since a3.equals(a1), this will in fact remove
        // a1...
        assertTrue(a1.equals(a3));
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        XYTextAnnotation a1 = new XYTextAnnotation("Text", 10.0, 20.0);
        XYTextAnnotation a2 = new XYTextAnnotation("Text", 10.0, 20.0);
        assertTrue(a1.equals(a2));

        // text
        a1 = new XYTextAnnotation("ABC", 10.0, 20.0);
        assertFalse(a1.equals(a2));
        a2 = new XYTextAnnotation("ABC", 10.0, 20.0);
        assertTrue(a1.equals(a2));

        // x
        a1 = new XYTextAnnotation("ABC", 11.0, 20.0);
        assertFalse(a1.equals(a2));
        a2 = new XYTextAnnotation("ABC", 11.0, 20.0);
        assertTrue(a1.equals(a2));

        // y
        a1 = new XYTextAnnotation("ABC", 11.0, 22.0);
        assertFalse(a1.equals(a2));
        a2 = new XYTextAnnotation("ABC", 11.0, 22.0);
        assertTrue(a1.equals(a2));

        // font
        a1.setFont(new Font("Serif", Font.PLAIN, 23));
        assertFalse(a1.equals(a2));
        a2.setFont(new Font("Serif", Font.PLAIN, 23));
        assertTrue(a1.equals(a2));

        // paint
        GradientPaint gp1 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
                4.0f, Color.yellow);
        GradientPaint gp2 = new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
                4.0f, Color.yellow);
        a1.setPaint(gp1);
        assertFalse(a1.equals(a2));
        a2.setPaint(gp2);
        assertTrue(a1.equals(a2));

        // rotation anchor
        a1.setRotationAnchor(TextAnchor.BASELINE_RIGHT);
        assertFalse(a1.equals(a2));
        a2.setRotationAnchor(TextAnchor.BASELINE_RIGHT);
        assertTrue(a1.equals(a2));

        // rotation angle
        a1.setRotationAngle(12.3);
        assertFalse(a1.equals(a2));
        a2.setRotationAngle(12.3);
        assertTrue(a1.equals(a2));

        // text anchor
        a1.setTextAnchor(TextAnchor.BASELINE_RIGHT);
        assertFalse(a1.equals(a2));
        a2.setTextAnchor(TextAnchor.BASELINE_RIGHT);
        assertTrue(a1.equals(a2));

        a1.setBackgroundPaint(gp1);
        assertFalse(a1.equals(a2));
        a2.setBackgroundPaint(gp1);
        assertTrue(a1.equals(a2));

        a1.setOutlinePaint(gp1);
        assertFalse(a1.equals(a2));
        a2.setOutlinePaint(gp1);
        assertTrue(a1.equals(a2));

        a1.setOutlineStroke(new BasicStroke(1.2f));
        assertFalse(a1.equals(a2));
        a2.setOutlineStroke(new BasicStroke(1.2f));
        assertTrue(a1.equals(a2));

        a1.setOutlineVisible(!a1.isOutlineVisible());
        assertFalse(a1.equals(a2));
        a2.setOutlineVisible(a1.isOutlineVisible());
        assertTrue(a1.equals(a2));

    }
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

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

Examples of org.jfree.chart.annotations.XYTextAnnotation

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        XYTextAnnotation a1 = new XYTextAnnotation("Text", 10.0, 20.0);
        XYTextAnnotation a2 = null;
        try {
            a2 = (XYTextAnnotation) a1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(a1 != a2);
        assertTrue(a1.getClass() == a2.getClass());
        assertTrue(a1.equals(a2));
    }
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

    /**
     * Checks that this class implements PublicCloneable.
     */
    public void testPublicCloneable() {
        XYTextAnnotation a1 = new XYTextAnnotation("Text", 10.0, 20.0);
        assertTrue(a1 instanceof PublicCloneable);
    }
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.