Java Code Examples for org.jfree.chart.annotations.CategoryTextAnnotation#setValue()

The following examples show how to use org.jfree.chart.annotations.CategoryTextAnnotation#setValue() . 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: CategoryTextAnnotationTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {

    CategoryTextAnnotation a1 = new CategoryTextAnnotation("Test",
            "Category", 1.0);
    CategoryTextAnnotation a2 = new CategoryTextAnnotation("Test",
            "Category", 1.0);
    assertTrue(a1.equals(a2));

    // category
    a1.setCategory("Category 2");
    assertFalse(a1.equals(a2));
    a2.setCategory("Category 2");
    assertTrue(a1.equals(a2));

    // categoryAnchor
    a1.setCategoryAnchor(CategoryAnchor.START);
    assertFalse(a1.equals(a2));
    a2.setCategoryAnchor(CategoryAnchor.START);
    assertTrue(a1.equals(a2));

    // value
    a1.setValue(0.15);
    assertFalse(a1.equals(a2));
    a2.setValue(0.15);
    assertTrue(a1.equals(a2));

}
 
Example 2
Source File: CategoryTextAnnotationTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that the equals method can distinguish all the required fields.
 */
public void testEquals() {
    
    CategoryTextAnnotation a1 = new CategoryTextAnnotation(
        "Test", "Category", 1.0
    );
    CategoryTextAnnotation a2 = new CategoryTextAnnotation(
        "Test", "Category", 1.0
    );
    assertTrue(a1.equals(a2));
    
    // category 
    a1.setCategory("Category 2");
    assertFalse(a1.equals(a2));
    a2.setCategory("Category 2");
    assertTrue(a1.equals(a2));

    // categoryAnchor
    a1.setCategoryAnchor(CategoryAnchor.START);
    assertFalse(a1.equals(a2));
    a2.setCategoryAnchor(CategoryAnchor.START);
    assertTrue(a1.equals(a2));

    // value 
    a1.setValue(0.15);
    assertFalse(a1.equals(a2));
    a2.setValue(0.15);
    assertTrue(a1.equals(a2));
  
}