Examples of DialTextAnnotation


Examples of org.jfree.chart.plot.dial.DialTextAnnotation

      JRFont displayFont = jrPlot.getValueDisplay().getFont();
     
      String[] textLines = label.split("\\n");
      for(int i = 0; i < textLines.length; i++)
      {
        DialTextAnnotation dialAnnotation = new DialTextAnnotation(textLines[i]);
        if(displayFont != null)
        {
          dialAnnotation.setFont(JRFontUtil.getAwtFont(displayFont, getLocale()));
        }
        dialAnnotation.setPaint(jrPlot.getValueDisplay().getColor());
        dialAnnotation.setRadius(Math.sin(Math.PI/4.0) + i/10.0);
        dialAnnotation.setAnchor(TextAnchor.CENTER);
        dialPlot.addLayer(dialAnnotation);
      }
    }

    DialPointer needle = new DialPointer.Pointer();
View Full Code Here

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

      Font themeDisplayFont = getFont((JRFont)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_DISPLAY_FONT), displayFont, defaultBaseFontSize);
     
      String[] textLines = label.split("\\n");
      for(int i = 0; i < textLines.length; i++)
      {
        DialTextAnnotation dialAnnotation = new DialTextAnnotation(textLines[i]);
        dialAnnotation.setFont(themeDisplayFont);
        dialAnnotation.setPaint(Color.BLACK);
        dialAnnotation.setRadius(Math.sin(Math.PI/6.0) + i/10.0);
        dialAnnotation.setAnchor(TextAnchor.CENTER);
        dialPlot.addLayer(dialAnnotation);
      }
    }

    DialPointer needle = new ScaledDialPointer(dialUnitScale, 0.047);
View Full Code Here

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

      Font themeDisplayFont = JRFontUtil.getAwtFont(displayFont, getLocale());
     
      String[] textLines = label.split("\\n");
      for(int i = 0; i < textLines.length; i++)
      {
        DialTextAnnotation dialAnnotation = new DialTextAnnotation(textLines[i]);
        dialAnnotation.setFont(themeDisplayFont);
        dialAnnotation.setPaint(jrPlot.getValueDisplay().getColor());
        dialAnnotation.setRadius(Math.sin(Math.PI/4.0) + i/10.0);
        dialAnnotation.setAnchor(TextAnchor.CENTER);
        dialPlot.addLayer(dialAnnotation);
      }
    }

    DialPointer needle = new DialPointer.Pointer();
View Full Code Here

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

      JRFont displayFont = jrPlot.getValueDisplay().getFont();
      Font themeDisplayFont = getFont((JRFont)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_DISPLAY_FONT), displayFont, defaultBaseFontSize);
      String[] textLines = label.split("\\n");
      for(int i = 0; i < textLines.length; i++)
      {
        DialTextAnnotation dialAnnotation = new DialTextAnnotation(textLines[i]);
        dialAnnotation.setFont(themeDisplayFont);
        dialAnnotation.setPaint(jrPlot.getValueDisplay().getColor());
        dialAnnotation.setRadius(Math.sin(Math.PI/4.0) + i/10.0);
        dialAnnotation.setAnchor(TextAnchor.CENTER);
        dialPlot.addLayer(dialAnnotation);
      }
    }

    DialPointer needle = new DialPointer.Pointer();
View Full Code Here

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

        label = new MessageFormat(label).format(new Object[]{String.valueOf((int)Math.pow(10, dialUnitScale-2))});
   
      String[] textLines = label.split("\\n");
      for(int i = 0; i < textLines.length; i++)
      {
        DialTextAnnotation dialAnnotation = new DialTextAnnotation(textLines[i]);
        dialAnnotation.setFont(themeDisplayFont);
        dialAnnotation.setPaint(Color.WHITE);
        dialAnnotation.setRadius(Math.sin(Math.PI/4.0) + i/10.0);
        dialAnnotation.setAnchor(TextAnchor.CENTER);
        dialPlot.addLayer(dialAnnotation);
      }
    }

    //DialPointer needle = new DialPointer.Pointer();
View Full Code Here

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        DialTextAnnotation a1 = new DialTextAnnotation("A1");
        DialTextAnnotation a2 = new DialTextAnnotation("A1");
        assertTrue(a1.equals(a2));

        // angle
        a1.setAngle(1.1);
        assertFalse(a1.equals(a2));
        a2.setAngle(1.1);
        assertTrue(a1.equals(a2));

        // radius
        a1.setRadius(9.9);
        assertFalse(a1.equals(a2));
        a2.setRadius(9.9);
        assertTrue(a1.equals(a2));

        // font
        Font f = new Font("SansSerif", Font.PLAIN, 14);
        a1.setFont(f);
        assertFalse(a1.equals(a2));
        a2.setFont(f);
        assertTrue(a1.equals(a2));

        // paint
        a1.setPaint(Color.red);
        assertFalse(a1.equals(a2));
        a2.setPaint(Color.red);
        assertTrue(a1.equals(a2));

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

        // check an inherited attribute
        a1.setVisible(false);
        assertFalse(a1.equals(a2));
        a2.setVisible(false);
        assertTrue(a1.equals(a2));
    }
View Full Code Here

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

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

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        // test a default instance
        DialTextAnnotation a1 = new DialTextAnnotation("A1");
        DialTextAnnotation a2 = null;
        try {
            a2 = (DialTextAnnotation) a1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(a1 != a2);
        assertTrue(a1.getClass() == a2.getClass());
        assertTrue(a1.equals(a2));

        // check that the listener lists are independent
        MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
        a1.addChangeListener(l1);
        assertTrue(a1.hasListener(l1));
        assertFalse(a2.hasListener(l1));

    }
View Full Code Here

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        // test a default instance
        DialTextAnnotation a1 = new DialTextAnnotation("A1");
        DialTextAnnotation a2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(a1);
            out.close();

            ObjectInput in = new ObjectInputStream(
                    new ByteArrayInputStream(buffer.toByteArray()));
            a2 = (DialTextAnnotation) in.readObject();
            in.close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        assertEquals(a1, a2);

        // test a custom instance
        a1 = new DialTextAnnotation("A1");
        a1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,
                Color.blue));
        a2 = null;

        try {
View Full Code Here

Examples of org.jfree.chart.plot.dial.DialTextAnnotation

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        DialTextAnnotation a1 = new DialTextAnnotation("A1");
        DialTextAnnotation a2 = new DialTextAnnotation("A1");
        assertTrue(a1.equals(a2));

        // angle
        a1.setAngle(1.1);
        assertFalse(a1.equals(a2));
        a2.setAngle(1.1);
        assertTrue(a1.equals(a2));

        // radius
        a1.setRadius(9.9);
        assertFalse(a1.equals(a2));
        a2.setRadius(9.9);
        assertTrue(a1.equals(a2));

        // font
        Font f = new Font("SansSerif", Font.PLAIN, 14);
        a1.setFont(f);
        assertFalse(a1.equals(a2));
        a2.setFont(f);
        assertTrue(a1.equals(a2));

        // paint
        a1.setPaint(Color.red);
        assertFalse(a1.equals(a2));
        a2.setPaint(Color.red);
        assertTrue(a1.equals(a2));

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

        // check an inherited attribute
        a1.setVisible(false);
        assertFalse(a1.equals(a2));
        a2.setVisible(false);
        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.