Examples of XYTextAnnotation


Examples of org.jfree.chart.annotations.XYTextAnnotation

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        XYTextAnnotation a1 = new XYTextAnnotation("Text", 10.0, 20.0);
        a1.setOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,
                Color.blue));
        XYTextAnnotation a2 = null;

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

Examples of org.jfree.chart.annotations.XYTextAnnotation

    protected void applyToXYAnnotation(XYAnnotation annotation) {
        if (annotation == null) {
            throw new IllegalArgumentException("Null 'annotation' argument.");
        }
        if (annotation instanceof XYTextAnnotation) {
            XYTextAnnotation xyta = (XYTextAnnotation) annotation;
            xyta.setFont(this.smallFont);
            xyta.setPaint(this.itemLabelPaint);
        }
    }
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

    NumberAxis numberaxis = (NumberAxis)xyplot.getDomainAxis();
    numberaxis.setUpperMargin(0.12D);
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis numberaxis1 = (NumberAxis)xyplot.getRangeAxis();
    numberaxis1.setAutoRangeIncludesZero(false);
    XYTextAnnotation xytextannotation = null;
    Font font = new Font("SansSerif", 0, 9);
    xytextannotation = new XYTextAnnotation("3rd", 36.5D, 11.76D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    xytextannotation = new XYTextAnnotation("5th", 36.5D, 12.039999999999999D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    xytextannotation = new XYTextAnnotation("10th", 36.5D, 12.493D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    xytextannotation = new XYTextAnnotation("25th", 36.5D, 13.313000000000001D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    xytextannotation = new XYTextAnnotation("50th", 36.5D, 14.33D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    xytextannotation = new XYTextAnnotation("75th", 36.5D, 15.478D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    xytextannotation = new XYTextAnnotation("90th", 36.5D, 16.641999999999999D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    xytextannotation = new XYTextAnnotation("95th", 36.5D, 17.408000000000001D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    xytextannotation = new XYTextAnnotation("97th", 36.5D, 17.936D);
    xytextannotation.setFont(font);
    xytextannotation.setTextAnchor(TextAnchor.HALF_ASCENT_LEFT);
    xyplot.addAnnotation(xytextannotation);
    ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
  }
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

    StandardXYItemRenderer standardxyitemrenderer = new StandardXYItemRenderer();
    NumberAxis numberaxis = new NumberAxis("Range 1");
    XYPlot xyplot = new XYPlot(xydataset, null, numberaxis,
        standardxyitemrenderer);
    xyplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    XYTextAnnotation xytextannotation = new XYTextAnnotation("Hello!", 50D,
        10000D);
    xytextannotation.setFont(new Font("SansSerif", 0, 9));
    xytextannotation.setRotationAngle(0.78539816339744828D);
    xyplot.addAnnotation(xytextannotation);
    XYDataset xydataset1 = createDataset2();
    StandardXYItemRenderer standardxyitemrenderer1 = new StandardXYItemRenderer();
    NumberAxis numberaxis1 = new NumberAxis("Range 2");
    numberaxis1.setAutoRangeIncludesZero(false);
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

        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

    /**
     * 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));
     
    }
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) {
            System.err.println("XYTextAnnotationTests.testCloning: failed to clone.");
        }
        assertTrue(a1 != a2);
        assertTrue(a1.getClass() == a2.getClass());
        assertTrue(a1.equals(a2));
    }
View Full Code Here

Examples of org.jfree.chart.annotations.XYTextAnnotation

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

        XYTextAnnotation a1 = new XYTextAnnotation("Text", 10.0, 20.0);
        XYTextAnnotation a2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(a1);
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));
    }
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.