List of usage examples for org.jfree.data.time.ohlc OHLCSeries getPeriod
public RegularTimePeriod getPeriod(int index)
From source file:org.jfree.data.time.ohlc.OHLCSeriesTest.java
/** * Check that the maximum item count can be applied retrospectively. *//* w w w . jav a 2 s . c om*/ @Test public void testSetMaximumItemCount2() { OHLCSeries s1 = new OHLCSeries("s1"); s1.add(new Year(2006), 1.0, 1.1, 1.1, 1.1); s1.add(new Year(2007), 2.0, 2.2, 2.2, 2.2); s1.add(new Year(2008), 3.0, 3.3, 3.3, 3.3); s1.setMaximumItemCount(2); assertEquals(new Year(2007), s1.getPeriod(0)); assertEquals(new Year(2008), s1.getPeriod(1)); }
From source file:org.jfree.data.time.ohlc.OHLCSeriesTest.java
/** * Simple test for the remove() method./* w ww. j a v a 2 s.com*/ */ @Test public void testRemove() { OHLCSeries s1 = new OHLCSeries("s1"); s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0); s1.add(new Year(2011), 2.1, 4.1, 1.1, 3.1); s1.add(new Year(2010), 2.2, 4.2, 1.2, 3.2); assertEquals(3, s1.getItemCount()); s1.remove(new Year(2010)); assertEquals(new Year(2011), s1.getPeriod(1)); s1.remove(new Year(2006)); assertEquals(new Year(2011), s1.getPeriod(0)); }
From source file:org.jfree.data.time.ohlc.OHLCSeriesTest.java
/** * A check for the remove(int) method.// w ww. j av a2 s . co m */ @Test public void testRemove_int() { OHLCSeries s1 = new OHLCSeries("s1"); s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0); s1.add(new Year(2011), 2.1, 4.1, 1.1, 3.1); s1.add(new Year(2010), 2.2, 4.2, 1.2, 3.2); assertEquals(3, s1.getItemCount()); s1.remove(s1.getItemCount() - 1); assertEquals(2, s1.getItemCount()); assertEquals(new Year(2010), s1.getPeriod(1)); }
From source file:org.jfree.data.time.ohlc.OHLCSeriesTest.java
/** * A simple check that the maximumItemCount attribute is working. *///from ww w . ja v a2 s. c o m @Test public void testSetMaximumItemCount() { OHLCSeries s1 = new OHLCSeries("s1"); assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount()); s1.setMaximumItemCount(2); assertEquals(2, s1.getMaximumItemCount()); s1.add(new Year(2006), 1.0, 1.1, 1.1, 1.1); s1.add(new Year(2007), 2.0, 2.2, 2.2, 2.2); s1.add(new Year(2008), 3.0, 3.3, 3.3, 3.3); assertEquals(new Year(2007), s1.getPeriod(0)); assertEquals(new Year(2008), s1.getPeriod(1)); }