org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer Java Examples

The following examples show how to use org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer. 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: StatisticalLineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultStatisticalCategoryDataset dataset
            = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(3.0, 4.0, "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset,
                new CategoryAxis("Category"), new NumberAxis("Value"),
                new StatisticalLineAndShapeRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200,
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
Example #2
Source File: StatisticalLineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Draws the chart with a <code>null</code> info object to make sure that 
 * no exceptions are thrown (particularly by code in the renderer).
 */
public void testDrawWithNullInfo() {
    boolean success = false;
    try {
        DefaultStatisticalCategoryDataset dataset 
            = new DefaultStatisticalCategoryDataset();
        dataset.add(1.0, 2.0, "S1", "C1");
        dataset.add(3.0, 4.0, "S1", "C2");
        CategoryPlot plot = new CategoryPlot(dataset, 
                new CategoryAxis("Category"), new NumberAxis("Value"), 
                new StatisticalLineAndShapeRenderer());
        JFreeChart chart = new JFreeChart(plot);
        /* BufferedImage image = */ chart.createBufferedImage(300, 200, 
                null);
        success = true;
    }
    catch (NullPointerException e) {
        e.printStackTrace();
        success = false;
    }
    assertTrue(success);
}
 
Example #3
Source File: StatisticalLineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    StatisticalLineAndShapeRenderer r1
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    r1.setErrorIndicatorPaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setErrorIndicatorPaint(Color.red);
    assertTrue(r2.equals(r1));
}
 
Example #4
Source File: StatisticalLineAndShapeRendererTests.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() {
    StatisticalLineAndShapeRenderer r1
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
 
Example #5
Source File: StatisticalLineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    StatisticalLineAndShapeRenderer r1 
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2 
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));
    
    r1.setErrorIndicatorPaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setErrorIndicatorPaint(Color.red);
    assertTrue(r2.equals(r1));
}
 
Example #6
Source File: StatisticalLineAndShapeRendererTests.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() {
    StatisticalLineAndShapeRenderer r1 
        = new StatisticalLineAndShapeRenderer();
    StatisticalLineAndShapeRenderer r2 
        = new StatisticalLineAndShapeRenderer();
    assertTrue(r1.equals(r2));
    int h1 = r1.hashCode();
    int h2 = r2.hashCode();
    assertEquals(h1, h2);
}
 
Example #7
Source File: StatisticalLineAndShapeRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Check that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    StatisticalLineAndShapeRenderer r1
            = new StatisticalLineAndShapeRenderer();
    assertTrue(r1 instanceof PublicCloneable);
}