org.jfree.data.xy.OHLCDataItem Java Examples

The following examples show how to use org.jfree.data.xy.OHLCDataItem. 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: DefaultOHLCDatasetTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A small test for the data range calculated on this dataset.
 */
public void testDataRange() {
    OHLCDataItem[] data = new OHLCDataItem[3];
    data[0] = new OHLCDataItem(new Date(11L), 2.0, 4.0, 1.0, 3.0, 100.0);
    data[1] = new OHLCDataItem(new Date(22L), 4.0, 9.0, 2.0, 5.0, 120.0);
    data[2] = new OHLCDataItem(new Date(33L), 3.0, 7.0, 3.0, 6.0, 140.0);
    DefaultOHLCDataset d = new DefaultOHLCDataset("S1", data);
    Range r = DatasetUtilities.findRangeBounds(d, true);
    assertEquals(1.0, r.getLowerBound(), EPSILON);
    assertEquals(9.0, r.getUpperBound(), EPSILON);
}
 
Example #2
Source File: OHLCDataItemTests.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() {
    OHLCDataItem i1 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    OHLCDataItem i2 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    assertTrue(i1.equals(i2));
    assertTrue(i2.equals(i1));
}
 
Example #3
Source File: OHLCDataItemTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Instances of this class are immutable - cloning not required.
 */
public void testCloning() {
    OHLCDataItem i1 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    assertFalse(i1 instanceof Cloneable);
}
 
Example #4
Source File: OHLCDataItemTests.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() {     
    OHLCDataItem i1 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    OHLCDataItem i2 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    assertTrue(i1.equals(i2));
    assertTrue(i2.equals(i1));
}
 
Example #5
Source File: OHLCDataItemTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Instances of this class are immutable - cloning not required.
 */
public void testCloning() {
    OHLCDataItem i1 = new OHLCDataItem(
        new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0
    );
    assertFalse(i1 instanceof Cloneable);
}
 
Example #6
Source File: DefaultOHLCDatasetTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Verify that this class implements {@link PublicCloneable}.
 */
public void testPublicCloneable() {
    DefaultOHLCDataset d1 = new DefaultOHLCDataset("Series 1",
            new OHLCDataItem[0]);
    assertTrue(d1 instanceof PublicCloneable);
}