org.jfree.chart.annotations.XYShapeAnnotation Java Examples

The following examples show how to use org.jfree.chart.annotations.XYShapeAnnotation. 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: ScatterPlot.java    From Benchmark with GNU General Public License v2.0 5 votes vote down vote up
public static void makePoint(XYPlot xyplot, Point2D location, double radius, Color color ) {
    double x = location.getX() - radius/2;
    double y = location.getY() - radius/2;
    Shape dot = new Ellipse2D.Double(x, y, radius, radius);
    XYShapeAnnotation area = new XYShapeAnnotation(dot, new BasicStroke(), color, color );
    xyplot.addAnnotation( area );
}
 
Example #2
Source File: ScatterPlot.java    From Benchmark with GNU General Public License v2.0 5 votes vote down vote up
public static void makeTriangle(XYPlot xyplot, Point2D location, Color color ) {
    Polygon p = new Polygon();
    p.addPoint(0,0);
    p.addPoint(100,0);
    p.addPoint(100,100);
    XYShapeAnnotation area = new XYShapeAnnotation(p, new BasicStroke(), color, color );
    xyplot.addAnnotation( area );
}
 
Example #3
Source File: ScatterPlot.java    From Benchmark with GNU General Public License v2.0 5 votes vote down vote up
public static void makeOval(XYPlot xyplot, double x, double y, double w, int h, int angle) {
    x = x * Math.sqrt(2);
    Shape oval = new Ellipse2D.Double(x, y, w, h);
    Shape diag = rotate( oval, angle );
    XYShapeAnnotation area = new XYShapeAnnotation(diag, new BasicStroke(), Color.gray );
    xyplot.addAnnotation( area );
}
 
Example #4
Source File: XYShapeAnnotationTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Two objects that are equal are required to return the same hashCode.
 */
public void testHashCode() {
    XYShapeAnnotation a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYShapeAnnotation a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    int h1 = a1.hashCode();
    int h2 = a2.hashCode();
    assertEquals(h1, h2);
}
 
Example #5
Source File: XYShapeAnnotationTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Checks that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    XYShapeAnnotation a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1 instanceof PublicCloneable);
}
 
Example #6
Source File: XYShapeAnnotationTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    XYShapeAnnotation a1 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), 
            new BasicStroke(1.2f), Color.red, Color.blue);
    XYShapeAnnotation a2 = new XYShapeAnnotation(
            new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), 
            new BasicStroke(1.2f), Color.red, Color.blue);
    assertTrue(a1.equals(a2));
    int h1 = a1.hashCode();
    int h2 = a2.hashCode();
    assertEquals(h1, h2);
}
 
Example #7
Source File: ScatterPlot.java    From Benchmark with GNU General Public License v2.0 4 votes vote down vote up
public static void makeRect(XYPlot xyplot, Point2D location, double height, double width, Color color ) {
    Shape rect = new Rectangle2D.Double(location.getX(), location.getY(), width, height);
    XYShapeAnnotation area = new XYShapeAnnotation(rect, new BasicStroke(), color, color );
    xyplot.addAnnotation( area );
}