List of usage examples for org.jfree.data.time TimeSeries getMaxY
public double getMaxY()
null
and Double.NaN
values. From source file:utilesChart.util.TimeSeriesCollection.java
/** * Returns the bounds for the y-values in the dataset. * * @param visibleSeriesKeys the visible series keys. * @param xRange the x-range (null not permitted). * @param includeInterval ignored./*w w w. j av a 2 s . c om*/ * * @return The bounds. * * @since 1.0.14 */ public Range getRangeBounds(List visibleSeriesKeys, Range xRange, boolean includeInterval) { Range result = null; Iterator iterator = visibleSeriesKeys.iterator(); while (iterator.hasNext()) { Comparable seriesKey = (Comparable) iterator.next(); TimeSeries series = getSeries(seriesKey); Range r = null; r = new Range(series.getMinY(), series.getMaxY()); // FIXME: Here we are ignoring the xRange result = Range.combine(result, r); } return result; }
From source file:org.jfree.data.time.TimeSeriesCollection.java
/** * Returns the bounds for the y-values in the dataset. * /*from www. j a v a 2 s.co m*/ * @param includeInterval ignored for this dataset. * * @return The range of value in the dataset (possibly <code>null</code>). * * @since 1.0.15 */ public Range getRangeBounds(boolean includeInterval) { Range result = null; Iterator iterator = this.data.iterator(); while (iterator.hasNext()) { TimeSeries series = (TimeSeries) iterator.next(); Range r = new Range(series.getMinY(), series.getMaxY()); result = Range.combineIgnoringNaN(result, r); } return result; }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Some checks for the getMaxY() method. *//*from w w w. j a v a2s . co m*/ public void testGetMaxY() { TimeSeries s1 = new TimeSeries("S1"); assertTrue(Double.isNaN(s1.getMaxY())); s1.add(new Year(2008), 1.1); assertEquals(1.1, s1.getMaxY(), EPSILON); s1.add(new Year(2009), 2.2); assertEquals(2.2, s1.getMaxY(), EPSILON); s1.add(new Year(2000), 99.9); assertEquals(99.9, s1.getMaxY(), EPSILON); s1.add(new Year(2002), -1.1); assertEquals(99.9, s1.getMaxY(), EPSILON); s1.add(new Year(2003), null); assertEquals(99.9, s1.getMaxY(), EPSILON); s1.addOrUpdate(new Year(2000), null); assertEquals(2.2, s1.getMaxY(), EPSILON); }
From source file:org.jfree.data.time.TimeSeriesTest.java
/** * Some checks for the getMaxY() method. *//*from w w w . j a va2 s . c o m*/ @Test public void testGetMaxY() { TimeSeries s1 = new TimeSeries("S1"); assertTrue(Double.isNaN(s1.getMaxY())); s1.add(new Year(2008), 1.1); assertEquals(1.1, s1.getMaxY(), EPSILON); s1.add(new Year(2009), 2.2); assertEquals(2.2, s1.getMaxY(), EPSILON); s1.add(new Year(2000), 99.9); assertEquals(99.9, s1.getMaxY(), EPSILON); s1.add(new Year(2002), -1.1); assertEquals(99.9, s1.getMaxY(), EPSILON); s1.add(new Year(2003), null); assertEquals(99.9, s1.getMaxY(), EPSILON); s1.addOrUpdate(new Year(2000), null); assertEquals(2.2, s1.getMaxY(), EPSILON); }
From source file:org.jfree.data.time.TimeSeriesTest.java
@Test public void testGetMaxY2() { TimeSeries ts = new TimeSeries("Time Series"); assertTrue(Double.isNaN(ts.getMaxY())); ts.add(new Year(2014), 1.0); assertEquals(1.0, ts.getMaxY(), EPSILON); ts.addOrUpdate(new Year(2014), null); assertTrue(Double.isNaN(ts.getMaxY())); ts.addOrUpdate(new Year(2014), 1.0); assertEquals(1.0, ts.getMaxY(), EPSILON); ts.clear();// w w w .j a v a 2s . com assertTrue(Double.isNaN(ts.getMaxY())); }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Some checks for the update(RegularTimePeriod...method). */// ww w. j av a2 s . c o m public void testUpdate_RegularTimePeriod() { TimeSeries s1 = new TimeSeries("S1"); s1.add(new Year(2010), 1.1); s1.add(new Year(2011), 2.2); s1.add(new Year(2012), 3.3); s1.update(new Year(2012), 4.4); assertEquals(4.4, s1.getMaxY(), EPSILON); s1.update(new Year(2010), 0.5); assertEquals(0.5, s1.getMinY(), EPSILON); s1.update(new Year(2012), null); assertEquals(2.2, s1.getMaxY(), EPSILON); s1.update(new Year(2010), null); assertEquals(2.2, s1.getMinY(), EPSILON); }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Checks that the min and max y values are updated correctly when copying * a subset.//w w w . j av a 2s .co m * * @throws java.lang.CloneNotSupportedException */ public void testCreateCopy3() throws CloneNotSupportedException { TimeSeries s1 = new TimeSeries("S1"); s1.add(new Year(2009), 100.0); s1.add(new Year(2010), 101.0); s1.add(new Year(2011), 102.0); assertEquals(100.0, s1.getMinY(), EPSILON); assertEquals(102.0, s1.getMaxY(), EPSILON); TimeSeries s2 = s1.createCopy(0, 1); assertEquals(100.0, s2.getMinY(), EPSILON); assertEquals(101.0, s2.getMaxY(), EPSILON); TimeSeries s3 = s1.createCopy(1, 2); assertEquals(101.0, s3.getMinY(), EPSILON); assertEquals(102.0, s3.getMaxY(), EPSILON); }
From source file:org.jfree.data.time.TimeSeriesTest.java
/** * Some checks for the update(RegularTimePeriod...method). *///from ww w . j a v a2 s . c o m @Test public void testUpdate_RegularTimePeriod() { TimeSeries s1 = new TimeSeries("S1"); s1.add(new Year(2010), 1.1); s1.add(new Year(2011), 2.2); s1.add(new Year(2012), 3.3); s1.update(new Year(2012), 4.4); assertEquals(4.4, s1.getMaxY(), EPSILON); s1.update(new Year(2010), 0.5); assertEquals(0.5, s1.getMinY(), EPSILON); s1.update(new Year(2012), null); assertEquals(2.2, s1.getMaxY(), EPSILON); s1.update(new Year(2010), null); assertEquals(2.2, s1.getMinY(), EPSILON); }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * A test for the clear method./*w ww. ja v a 2s . c o m*/ */ public void testClear() { TimeSeries s1 = new TimeSeries("S1"); s1.add(new Year(2009), 1.1); s1.add(new Year(2010), 2.2); assertEquals(2, s1.getItemCount()); s1.clear(); assertEquals(0, s1.getItemCount()); assertTrue(Double.isNaN(s1.getMinY())); assertTrue(Double.isNaN(s1.getMaxY())); }
From source file:org.jfree.data.time.junit.TimeSeriesTest.java
/** * Check that the item bounds are determined correctly when there is a * maximum item count and a new value is added. *//*from w w w .j av a 2 s . c o m*/ public void testAdd() { TimeSeries s1 = new TimeSeries("S1"); s1.setMaximumItemCount(2); s1.add(new Year(2010), 1.1); s1.add(new Year(2011), 2.2); s1.add(new Year(2012), 3.3); assertEquals(2, s1.getItemCount()); assertEquals(2.2, s1.getMinY(), EPSILON); assertEquals(3.3, s1.getMaxY(), EPSILON); }