List of usage examples for org.jfree.data.xy XYIntervalSeries XYIntervalSeries
public XYIntervalSeries(Comparable key)
From source file:com.att.aro.ui.view.diagnostictab.plot.NetworkTypePlot.java
private void createDataSeriesForAllNetworkTypes(final Map<NetworkType, XYIntervalSeries> seriesMap, final XYIntervalSeriesCollection networkDataSeries) { for (NetworkType nt : NetworkType.values()) { XYIntervalSeries series = new XYIntervalSeries(nt); seriesMap.put(nt, series);/* ww w . j a v a 2 s. c om*/ networkDataSeries.addSeries(series); } }
From source file:org.jfree.data.xy.XYIntervalSeriesTest.java
/** * Serialize an instance, restore it, and check for equality. *///from ww w . j a va 2 s.c o m @Test public void testSerialization() { XYIntervalSeries s1 = new XYIntervalSeries("s1"); s1.add(1.0, 0.5, 1.5, 2.0, 1.9, 2.1); XYIntervalSeries s2 = (XYIntervalSeries) TestUtilities.serialised(s1); assertEquals(s1, s2); }
From source file:org.jfree.data.xy.XYIntervalSeriesTest.java
/** * Simple test for the indexOf() method. */// w w w .j a v a2 s . c o m @Test public void testIndexOf() { XYIntervalSeries s1 = new XYIntervalSeries("Series 1"); s1.add(1.0, 1.0, 1.0, 2.0, 1.9, 2.1); s1.add(2.0, 2.0, 2.0, 3.0, 2.9, 3.1); s1.add(3.0, 3.0, 3.0, 4.0, 3.9, 4.1); assertEquals(0, s1.indexOf(new Double(1.0))); }
From source file:org.jfree.data.xy.XYIntervalSeriesCollectionTest.java
/** * Some basic checks for the removeSeries() method. *///from www. ja v a 2 s.co m @Test public void testRemoveSeries() { XYIntervalSeriesCollection c = new XYIntervalSeriesCollection(); XYIntervalSeries s1 = new XYIntervalSeries("s1"); c.addSeries(s1); c.removeSeries(0); assertEquals(0, c.getSeriesCount()); c.addSeries(s1); boolean pass = false; try { c.removeSeries(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { c.removeSeries(1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.xy.junit.XYIntervalSeriesCollectionTest.java
/** * Serialize an instance, restore it, and check for equality. */// www.ja v a 2 s . c o m public void testSerialization() { XYIntervalSeriesCollection c1 = new XYIntervalSeriesCollection(); XYIntervalSeries s1 = new XYIntervalSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3, 1.4, 1.5); XYIntervalSeriesCollection c2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(c1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); c2 = (XYIntervalSeriesCollection) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(c1, c2); // check independence c1.addSeries(new XYIntervalSeries("Empty")); assertFalse(c1.equals(c2)); c2.addSeries(new XYIntervalSeries("Empty")); assertTrue(c1.equals(c2)); }
From source file:org.jfree.data.xy.XYIntervalSeriesCollectionTest.java
/** * A test for bug report 1170825 (originally affected XYSeriesCollection, * this test is just copied over).//from w ww. ja v a2 s . c om */ @Test public void test1170825() { XYIntervalSeries s1 = new XYIntervalSeries("Series1"); XYIntervalSeriesCollection dataset = new XYIntervalSeriesCollection(); dataset.addSeries(s1); try { /* XYSeries s = */ dataset.getSeries(1); } catch (IllegalArgumentException e) { // correct outcome } catch (IndexOutOfBoundsException e) { assertTrue(false); // wrong outcome } }
From source file:org.jfree.data.xy.XYIntervalSeriesTest.java
/** * Simple test for the remove() method./*from w w w. ja v a 2s. co m*/ */ @Test public void testRemove() { XYIntervalSeries s1 = new XYIntervalSeries("Series 1"); s1.add(1.0, 1.0, 1.0, 2.0, 1.9, 2.1); s1.add(2.0, 2.0, 2.0, 2.0, 1.9, 2.1); s1.add(3.0, 3.0, 3.0, 3.0, 2.9, 3.1); assertEquals(3, s1.getItemCount()); s1.remove(new Double(2.0)); assertEquals(new Double(3.0), s1.getX(1)); s1.remove(new Double(1.0)); assertEquals(new Double(3.0), s1.getX(0)); }
From source file:org.jfree.data.xy.junit.XYIntervalSeriesCollectionTest.java
/** * Some basic checks for the removeSeries() method. *///from w ww .jav a 2 s. com public void testRemoveSeries() { XYIntervalSeriesCollection c = new XYIntervalSeriesCollection(); XYIntervalSeries s1 = new XYIntervalSeries("s1"); c.addSeries(s1); c.removeSeries(0); assertEquals(0, c.getSeriesCount()); c.addSeries(s1); boolean pass = false; try { c.removeSeries(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { c.removeSeries(1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.xy.XYIntervalSeriesTest.java
/** * When items are added with duplicate x-values, we expect them to remain * in the order they were added.// w ww . j a va2s. co m */ @Test public void testAdditionOfDuplicateXValues() { XYIntervalSeries s1 = new XYIntervalSeries("Series 1"); s1.add(1.0, 1.0, 1.0, 1.0, 1.0, 1.0); s1.add(2.0, 2.0, 2.0, 2.0, 2.0, 2.0); s1.add(2.0, 3.0, 3.0, 3.0, 3.0, 3.0); s1.add(2.0, 4.0, 4.0, 4.0, 4.0, 4.0); s1.add(3.0, 5.0, 5.0, 5.0, 5.0, 5.0); assertEquals(1.0, s1.getYValue(0), EPSILON); assertEquals(2.0, s1.getYValue(1), EPSILON); assertEquals(3.0, s1.getYValue(2), EPSILON); assertEquals(4.0, s1.getYValue(3), EPSILON); assertEquals(5.0, s1.getYValue(4), EPSILON); }
From source file:org.jfree.data.xy.junit.XYIntervalSeriesCollectionTest.java
/** * A test for bug report 1170825 (originally affected XYSeriesCollection, * this test is just copied over)./*from w w w . j av a 2 s .c o m*/ */ public void test1170825() { XYIntervalSeries s1 = new XYIntervalSeries("Series1"); XYIntervalSeriesCollection dataset = new XYIntervalSeriesCollection(); dataset.addSeries(s1); try { /* XYSeries s = */ dataset.getSeries(1); } catch (IllegalArgumentException e) { // correct outcome } catch (IndexOutOfBoundsException e) { assertTrue(false); // wrong outcome } }