Java Code Examples for org.jfree.chart.plot.PlotRenderingInfo#setPlotArea()

The following examples show how to use org.jfree.chart.plot.PlotRenderingInfo#setPlotArea() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlotRenderingInfoTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test the equals() method.
 */
public void testEquals() {
    PlotRenderingInfo p1 = new PlotRenderingInfo(new ChartRenderingInfo());
    PlotRenderingInfo p2 = new PlotRenderingInfo(new ChartRenderingInfo());
    assertTrue(p1.equals(p2));
    assertTrue(p2.equals(p1));

    p1.setPlotArea(new Rectangle(2, 3, 4, 5));
    assertFalse(p1.equals(p2));
    p2.setPlotArea(new Rectangle(2, 3, 4, 5));
    assertTrue(p1.equals(p2));

    p1.setDataArea(new Rectangle(2, 4, 6, 8));
    assertFalse(p1.equals(p2));
    p2.setDataArea(new Rectangle(2, 4, 6, 8));
    assertTrue(p1.equals(p2));

    p1.addSubplotInfo(new PlotRenderingInfo(null));
    assertFalse(p1.equals(p2));
    p2.addSubplotInfo(new PlotRenderingInfo(null));
    assertTrue(p1.equals(p2));

    p1.getSubplotInfo(0).setDataArea(new Rectangle(1, 2, 3, 4));
    assertFalse(p1.equals(p2));
    p2.getSubplotInfo(0).setDataArea(new Rectangle(1, 2, 3, 4));
    assertTrue(p1.equals(p2));
}
 
Example 2
Source File: PlotRenderingInfoTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Test the equals() method.
 */
public void testEquals() {       
    PlotRenderingInfo p1 = new PlotRenderingInfo(new ChartRenderingInfo());
    PlotRenderingInfo p2 = new PlotRenderingInfo(new ChartRenderingInfo());
    assertTrue(p1.equals(p2));
    assertTrue(p2.equals(p1));
    
    p1.setPlotArea(new Rectangle(2, 3, 4, 5));
    assertFalse(p1.equals(p2));
    p2.setPlotArea(new Rectangle(2, 3, 4, 5));
    assertTrue(p1.equals(p2));
    
    p1.setDataArea(new Rectangle(2, 4, 6, 8));
    assertFalse(p1.equals(p2));
    p2.setDataArea(new Rectangle(2, 4, 6, 8));
    assertTrue(p1.equals(p2));

    p1.addSubplotInfo(new PlotRenderingInfo(null));
    assertFalse(p1.equals(p2));
    p2.addSubplotInfo(new PlotRenderingInfo(null));
    assertTrue(p1.equals(p2));
    
    p1.getSubplotInfo(0).setDataArea(new Rectangle(1, 2, 3, 4));
    assertFalse(p1.equals(p2));
    p2.getSubplotInfo(0).setDataArea(new Rectangle(1, 2, 3, 4));
    assertTrue(p1.equals(p2));
}
 
Example 3
Source File: VenndiPlot.java    From chipster with MIT License 5 votes vote down vote up
/**
     * Draws the plot on a Java2D graphics device (such as the screen or 
     * a printer).
     *
     * @param g2  the graphics device.
     * @param area  the area within which the plot should be drawn.
     * @param anchor  the anchor point (<code>null</code> permitted).
     * @param parentState  the state from the parent plot, if there is one
     * (<code>null</code> permitted.)
     * @param info  collects info about the drawing (<code>null</code> permitted).
     * @throws NullPointerException  if g2 or area is null.
     */ 
    @Override
    public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, 
            java.awt.geom.Point2D anchor, PlotState parentState, 
            PlotRenderingInfo info) {
    	    	
    	
        // adjust for insets...
        this.getInsets().trim(area);

        if (info != null) {
            info.setPlotArea(area);
            info.setDataArea(area);
        }

        //this.setBackgroundPaint(Color.black);
        
        drawBackground(g2, area);
        drawOutline(g2, area);

        Shape savedClip = g2.getClip();
        g2.clip(area);
/*
        Composite originalComposite = g2.getComposite();		public Collection<String> getIdentifiers(AREAS areas) {
			return Arrays.asList(datas[areas.ordinal()]);
		}
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 
                getForegroundAlpha()));
*/
        drawVenn(g2, area, info);
        
        g2.setClip(savedClip);
   //   g2.setComposite(originalComposite);

        drawOutline(g2, area);
    }