Package org.jfree.chart.renderer

Examples of org.jfree.chart.renderer.LookupPaintScale$PaintItem


    /**
     * Creates a new <code>XYShapeRenderer</code> instance with default
     * attributes.
     */
    public XYShapeRenderer() {
        this.paintScale = new LookupPaintScale();
        this.useFillPaint = false;
        this.drawOutlines = false;
        this.useOutlinePaint = true;
        this.guideLinesVisible = false;
        this.guideLinePaint = Color.darkGray;
View Full Code Here


     * Creates a new <code>XYBlockRenderer</code> instance with default
     * attributes.
     */
    public XYBlockRenderer() {
        updateOffsets();
        this.paintScale = new LookupPaintScale();
    }
View Full Code Here

    // renderer.setBlockHeight(100);

    double increments = (maxZ - minZ) / 6;
    if (minZ == maxZ)
      maxZ++; // make sure the scale is valid
    LookupPaintScale scale = new LookupPaintScale(minZ, maxZ, Color.white);
    // PaintScale scale = new GrayPaintScale(minZ, maxZ);
    scale.add(minZ, Color.MAGENTA);
    scale.add(minZ + increments, Color.BLUE);
    scale.add(minZ + increments * 2, Color.GREEN);
    scale.add(minZ + increments * 3, Color.YELLOW);
    scale.add(minZ + increments * 4, Color.ORANGE);
    scale.add(minZ + increments * 5, Color.RED);
    renderer.setPaintScale(scale);

    NumberAxis xAxis = new NumberAxis(model.getDomainType().toString());
    xAxis.setLowerBound(minDomain);
    xAxis.setUpperBound(maxDomain);
View Full Code Here

                new NumberAxis("X"));
        assertTrue(l1.equals(l2));
        assertTrue(l2.equals(l1));

        // paintScale
        l1.setScale(new LookupPaintScale());
        assertFalse(l1.equals(l2));
        l2.setScale(new LookupPaintScale());
        assertTrue(l1.equals(l2));

        // axis
        l1.setAxis(new NumberAxis("Axis 2"));
        assertFalse(l1.equals(l2));
View Full Code Here

    /**
     * Creates a new <code>XYShapeRenderer</code> instance with default
     * attributes.
     */
    public XYShapeRenderer() {
        this.paintScale = new LookupPaintScale();
        this.useFillPaint = false;
        this.drawOutlines = false;
        this.useOutlinePaint = true;
        this.guideLinesVisible = false;
        this.guideLinePaint = Color.darkGray;
View Full Code Here

    /**
     * A test for the equals() method.
     */
    public void testEquals() {
        LookupPaintScale g1 = new LookupPaintScale();
        LookupPaintScale g2 = new LookupPaintScale();
        assertTrue(g1.equals(g2));
        assertTrue(g2.equals(g1));

        g1 = new LookupPaintScale(1.0, 2.0, Color.red);
        assertFalse(g1.equals(g2));
        g2 = new LookupPaintScale(1.0, 2.0, Color.red);
        assertTrue(g1.equals(g2));

        g1.add(new Double(1.5), new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
                4.0f, Color.blue));
        assertFalse(g1.equals(g2));
        g2.add(new Double(1.5), new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
                4.0f, Color.blue));
        assertTrue(g1.equals(g2));
    }
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        LookupPaintScale g1 = new LookupPaintScale();
        LookupPaintScale g2 = null;
        try {
            g2 = (LookupPaintScale) g1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(g1 != g2);
        assertTrue(g1.getClass() == g2.getClass());
        assertTrue(g1.equals(g2));

        // check independence
        g1.add(new Double(0.5), Color.red);
        assertFalse(g1.equals(g2));
        g2.add(new Double(0.5), Color.red);
        assertTrue(g1.equals(g2));

        // try with gradient paint
        g1 = new LookupPaintScale(1.0, 2.0, new GradientPaint(1.0f, 2.0f,
                Color.red, 3.0f, 4.0f, Color.green));
        g1.add(new Double(1.5), new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
                4.0f, Color.blue));
        g2 = null;
        try {
            g2 = (LookupPaintScale) g1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(g1 != g2);
        assertTrue(g1.getClass() == g2.getClass());
        assertTrue(g1.equals(g2));
    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        LookupPaintScale g1 = new LookupPaintScale();
        LookupPaintScale g2 = null;
        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(g1);
            out.close();

            ObjectInput in = new ObjectInputStream(
                    new ByteArrayInputStream(buffer.toByteArray()));
            g2 = (LookupPaintScale) in.readObject();
            in.close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        assertEquals(g1, g2);

        g1 = new LookupPaintScale(1.0, 2.0, new GradientPaint(1.0f, 2.0f,
                Color.red, 3.0f, 4.0f, Color.yellow));
        g1.add(new Double(1.5), new GradientPaint(1.1f, 2.2f, Color.red, 3.3f,
                4.4f, Color.blue));
        g2 = null;
        try {
View Full Code Here

    /**
     * Some checks for the default constructor.
     */
    public void testConstructor1() {
        LookupPaintScale s = new LookupPaintScale();
        assertEquals(0.0, s.getLowerBound(), EPSILON);
        assertEquals(1.0, s.getUpperBound(), EPSILON);
    }
View Full Code Here

    /**
     * Some checks for the other constructor.
     */
    public void testConstructor2() {
        LookupPaintScale s = new LookupPaintScale(1.0, 2.0, Color.red);
        assertEquals(1.0, s.getLowerBound(), EPSILON);
        assertEquals(2.0, s.getUpperBound(), EPSILON);
        assertEquals(Color.red, s.getDefaultPaint());
    }
View Full Code Here

TOP

Related Classes of org.jfree.chart.renderer.LookupPaintScale$PaintItem

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.