List of usage examples for org.jfree.data.xy DefaultIntervalXYDataset getSeriesKey
@Override public Comparable getSeriesKey(int series)
From source file:org.jfree.data.xy.DefaultIntervalXYDatasetTest.java
/** * Some checks for the getSeriesKey(int) method. *///from w ww . ja v a2 s. co m @Test public void testGetSeriesKey() { DefaultIntervalXYDataset d = createSampleDataset1(); assertEquals("S1", d.getSeriesKey(0)); assertEquals("S2", d.getSeriesKey(1)); // check for series key out of bounds boolean pass = false; try { /*Comparable k =*/ d.getSeriesKey(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { /*Comparable k =*/ d.getSeriesKey(2); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.xy.junit.DefaultIntervalXYDatasetTest.java
/** * Some checks for the getSeriesKey(int) method. *//*from w w w . ja va2 s. c o m*/ public void testGetSeriesKey() { DefaultIntervalXYDataset d = createSampleDataset1(); assertEquals("S1", d.getSeriesKey(0)); assertEquals("S2", d.getSeriesKey(1)); // check for series key out of bounds boolean pass = false; try { /*Comparable k =*/ d.getSeriesKey(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { /*Comparable k =*/ d.getSeriesKey(2); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.xy.DefaultIntervalXYDatasetTest.java
/** * Some tests for the addSeries() method. */// w ww .j a va 2 s .c o m @Test public void testAddSeries() { DefaultIntervalXYDataset d = new DefaultIntervalXYDataset(); d.addSeries("S1", new double[][] { { 1.0 }, { 0.5 }, { 1.5 }, { 2.0 }, { 2.5 }, { 1.5 } }); assertEquals(1, d.getSeriesCount()); assertEquals("S1", d.getSeriesKey(0)); // check that adding a series will overwrite the old series d.addSeries("S1", new double[][] { { 1.1 }, { 0.6 }, { 1.6 }, { 2.1 }, { 2.6 }, { 1.6 } }); assertEquals(1, d.getSeriesCount()); assertEquals(2.1, d.getYValue(0, 0), EPSILON); // check null key boolean pass = false; try { d.addSeries(null, new double[][] { { 1.1 }, { 0.6 }, { 1.6 }, { 2.1 }, { 2.6 }, { 1.6 } }); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); }
From source file:org.jfree.data.xy.junit.DefaultIntervalXYDatasetTest.java
/** * Some tests for the addSeries() method. *///from w w w . j a v a 2 s .c o m public void testAddSeries() { DefaultIntervalXYDataset d = new DefaultIntervalXYDataset(); d.addSeries("S1", new double[][] { { 1.0 }, { 0.5 }, { 1.5 }, { 2.0 }, { 2.5 }, { 1.5 } }); assertEquals(1, d.getSeriesCount()); assertEquals("S1", d.getSeriesKey(0)); // check that adding a series will overwrite the old series d.addSeries("S1", new double[][] { { 1.1 }, { 0.6 }, { 1.6 }, { 2.1 }, { 2.6 }, { 1.6 } }); assertEquals(1, d.getSeriesCount()); assertEquals(2.1, d.getYValue(0, 0), EPSILON); // check null key boolean pass = false; try { d.addSeries(null, new double[][] { { 1.1 }, { 0.6 }, { 1.6 }, { 2.1 }, { 2.6 }, { 1.6 } }); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); }