org.jfree.data.statistics.BoxAndWhiskerItem Java Examples
The following examples show how to use
org.jfree.data.statistics.BoxAndWhiskerItem.
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: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null min outlier value. */ public void testDrawWithNullMinOutlier() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(0.5), new Double(4.5), null, new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #2
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the getRangeBounds() method. */ public void testGetRangeBounds() { DefaultBoxAndWhiskerCategoryDataset d1 = new DefaultBoxAndWhiskerCategoryDataset(); d1.add(new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, new ArrayList()), "R1", "C1"); assertEquals(new Range(7.0, 8.0), d1.getRangeBounds(false)); assertEquals(new Range(7.0, 8.0), d1.getRangeBounds(true)); d1.add(new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, new ArrayList()), "R1", "C1"); assertEquals(new Range(7.5, 8.5), d1.getRangeBounds(false)); assertEquals(new Range(7.5, 8.5), d1.getRangeBounds(true)); d1.add(new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, new ArrayList()), "R2", "C1"); assertEquals(new Range(7.5, 9.5), d1.getRangeBounds(false)); assertEquals(new Range(7.5, 9.5), d1.getRangeBounds(true)); // this replaces the entry with the current minimum value, but the new // minimum value is now in a different item d1.add(new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 8.6, 9.6, new ArrayList()), "R1", "C1"); assertEquals(new Range(8.5, 9.6), d1.getRangeBounds(false)); assertEquals(new Range(8.5, 9.6), d1.getRangeBounds(true)); }
Example #3
Source File: BoxAndWhiskerItemTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { BoxAndWhiskerItem i1 = new BoxAndWhiskerItem( new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0), new ArrayList() ); BoxAndWhiskerItem i2 = new BoxAndWhiskerItem( new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0), new ArrayList() ); assertTrue(i1.equals(i2)); assertTrue(i2.equals(i1)); }
Example #4
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * A simple test for bug report 1701822. */ public void test1701822() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); try { dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), null, new Double(8.0), new ArrayList()), "ROW1", "COLUMN1"); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), new Double(7.0), null, new ArrayList()), "ROW1", "COLUMN2"); } catch (NullPointerException e) { assertTrue(false); } }
Example #5
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null Q3 value. */ public void testDrawWithNullQ3() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), null, new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #6
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null min regular value. */ public void testDrawWithNullMinRegular() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), null, new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #7
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null max regular value. */ public void testDrawWithNullMaxRegular() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(0.5), null, new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #8
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null min outlier value. */ public void testDrawWithNullMinOutlier() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(0.5), new Double(4.5), null, new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #9
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null max outlier value. */ public void testDrawWithNullMaxOutlier() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(0.5), new Double(4.5), new Double(-0.5), null, new java.util.ArrayList()), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #10
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Confirm that the equals method can distinguish all the required fields. */ public void testEquals() { DefaultBoxAndWhiskerCategoryDataset d1 = new DefaultBoxAndWhiskerCategoryDataset(); d1.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0), new ArrayList()), "ROW1", "COLUMN1"); DefaultBoxAndWhiskerCategoryDataset d2 = new DefaultBoxAndWhiskerCategoryDataset(); d2.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0), new ArrayList()), "ROW1", "COLUMN1"); assertTrue(d1.equals(d2)); assertTrue(d2.equals(d1)); }
Example #11
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * A simple test for bug report 1701822. */ public void test1701822() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); try { dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), null, new Double(8.0), new ArrayList()), "ROW1", "COLUMN1"); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), new Double(7.0), null, new ArrayList()), "ROW1", "COLUMN2"); } catch (NullPointerException e) { assertTrue(false); } }
Example #12
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the getRangeBounds() method. */ public void testGetRangeBounds() { DefaultBoxAndWhiskerCategoryDataset d1 = new DefaultBoxAndWhiskerCategoryDataset(); d1.add(new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, new ArrayList()), "R1", "C1"); assertEquals(new Range(7.0, 8.0), d1.getRangeBounds(false)); assertEquals(new Range(7.0, 8.0), d1.getRangeBounds(true)); d1.add(new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, new ArrayList()), "R1", "C1"); assertEquals(new Range(7.5, 8.5), d1.getRangeBounds(false)); assertEquals(new Range(7.5, 8.5), d1.getRangeBounds(true)); d1.add(new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, new ArrayList()), "R2", "C1"); assertEquals(new Range(7.5, 9.5), d1.getRangeBounds(false)); assertEquals(new Range(7.5, 9.5), d1.getRangeBounds(true)); // this replaces the entry with the current minimum value, but the new // minimum value is now in a different item d1.add(new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 8.6, 9.6, new ArrayList()), "R1", "C1"); assertEquals(new Range(8.5, 9.6), d1.getRangeBounds(false)); assertEquals(new Range(8.5, 9.6), d1.getRangeBounds(true)); }
Example #13
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null Q1 value. */ public void testDrawWithNullQ1() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), null, new Double(4.0), new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #14
Source File: DefaultBoxAndWhiskerXYDatasetTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the add() method. */ public void testAdd() { DefaultBoxAndWhiskerXYDataset dataset = new DefaultBoxAndWhiskerXYDataset("S1"); BoxAndWhiskerItem item1 = new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, new ArrayList()); dataset.add(new Date(33L), item1); assertEquals(1.0, dataset.getY(0, 0).doubleValue(), EPSILON); assertEquals(1.0, dataset.getMeanValue(0, 0).doubleValue(), EPSILON); assertEquals(2.0, dataset.getMedianValue(0, 0).doubleValue(), EPSILON); assertEquals(3.0, dataset.getQ1Value(0, 0).doubleValue(), EPSILON); assertEquals(4.0, dataset.getQ3Value(0, 0).doubleValue(), EPSILON); assertEquals(5.0, dataset.getMinRegularValue(0, 0).doubleValue(), EPSILON); assertEquals(6.0, dataset.getMaxRegularValue(0, 0).doubleValue(), EPSILON); assertEquals(7.0, dataset.getMinOutlier(0, 0).doubleValue(), EPSILON); assertEquals(8.0, dataset.getMaxOutlier(0, 0).doubleValue(), EPSILON); assertEquals(new Range(5.0, 6.0), dataset.getRangeBounds(false)); }
Example #15
Source File: DatasetUtilitiesTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the iterateToFindRangeBounds() method when applied to * a BoxAndWhiskerXYDataset. */ public void testIterateToFindRangeBounds_BoxAndWhiskerXYDataset() { DefaultBoxAndWhiskerXYDataset dataset = new DefaultBoxAndWhiskerXYDataset("Series 1"); List visibleSeriesKeys = new ArrayList(); visibleSeriesKeys.add("Series 1"); Range xRange = new Range(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, xRange, false)); dataset.add(new Date(50L), new BoxAndWhiskerItem(5.0, 4.9, 2.0, 8.0, 1.0, 9.0, 0.0, 10.0, new ArrayList())); assertEquals(new Range(5.0, 5.0), DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, xRange, false)); assertEquals(new Range(1.0, 9.0), DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, xRange, true)); }
Example #16
Source File: DefaultBoxAndWhiskerXYDatasetTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the getRangeBounds() method. */ public void testGetRangeBounds() { DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset("S"); d1.add(new Date(1L), new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, new ArrayList())); assertEquals(new Range(5.0, 6.0), d1.getRangeBounds(false)); assertEquals(new Range(5.0, 6.0), d1.getRangeBounds(true)); d1.add(new Date(1L), new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, new ArrayList())); assertEquals(new Range(5.0, 6.5), d1.getRangeBounds(false)); assertEquals(new Range(5.0, 6.5), d1.getRangeBounds(true)); d1.add(new Date(2L), new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, new ArrayList())); assertEquals(new Range(5.0, 7.5), d1.getRangeBounds(false)); assertEquals(new Range(5.0, 7.5), d1.getRangeBounds(true)); }
Example #17
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null max regular value. */ public void testDrawWithNullMaxRegular() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(0.5), null, new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #18
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null min regular value. */ public void testDrawWithNullMinRegular() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), null, new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #19
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null Q3 value. */ public void testDrawWithNullQ3() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), null, new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #20
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null Q1 value. */ public void testDrawWithNullQ1() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), null, new Double(4.0), new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #21
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null median value. */ public void testDrawWithNullMedian() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), null, new Double(0.0), new Double(4.0), new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #22
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null mean value. */ public void testDrawWithNullMean() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(null, new Double(2.0), new Double(0.0), new Double(4.0), new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; e.printStackTrace(); } assertTrue(success); }
Example #23
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Draws the chart with a <code>null</code> info object to make sure that * no exceptions are thrown (particularly by code in the renderer). */ public void testDrawWithNullInfo() { boolean success = false; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(0.0), new Double(4.0), new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, null); success = true; } catch (NullPointerException e) { success = false; } assertTrue(success); }
Example #24
Source File: DatasetUtilitiesTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the iterateToFindRangeBounds() method when applied to * a BoxAndWhiskerXYDataset. */ @Test public void testIterateToFindRangeBounds_BoxAndWhiskerXYDataset() { DefaultBoxAndWhiskerXYDataset dataset = new DefaultBoxAndWhiskerXYDataset("Series 1"); List visibleSeriesKeys = new ArrayList(); visibleSeriesKeys.add("Series 1"); Range xRange = new Range(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); assertNull(DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, xRange, false)); dataset.add(new Date(50L), new BoxAndWhiskerItem(5.0, 4.9, 2.0, 8.0, 1.0, 9.0, 0.0, 10.0, new ArrayList())); assertEquals(new Range(5.0, 5.0), DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, xRange, false)); assertEquals(new Range(1.0, 9.0), DatasetUtilities.iterateToFindRangeBounds(dataset, visibleSeriesKeys, xRange, true)); }
Example #25
Source File: BoxAndWhiskerRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null max outlier value. */ @Test public void testDrawWithNullMaxOutlier() { boolean success; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(0.5), new Double(4.5), new Double(-0.5), null, new java.util.ArrayList()), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #26
Source File: BoxAndWhiskerRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null min outlier value. */ @Test public void testDrawWithNullMinOutlier() { boolean success; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(0.5), new Double(4.5), null, new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #27
Source File: XYBoxAndWhiskerRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * A test for bug report 2909215. */ @Test public void test2909215() { DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset( "Series"); d1.add(new Date(1L), new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), null, null, null)); JFreeChart chart = ChartFactory.createBoxAndWhiskerChart("Title", "X", "Y", d1, true); try { BufferedImage image = new BufferedImage(400, 200, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 400, 200), null, null); g2.dispose(); } catch (Exception e) { fail("No exception should be thrown."); } }
Example #28
Source File: BoxAndWhiskerRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null min regular value. */ @Test public void testDrawWithNullMinRegular() { boolean success; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), null, new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #29
Source File: BoxAndWhiskerRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null Q3 value. */ @Test public void testDrawWithNullQ3() { boolean success; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), new Double(2.0), new Double(3.0), null, new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example #30
Source File: BoxAndWhiskerRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null median value. */ @Test public void testDrawWithNullMedian() { boolean success; try { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); dataset.add(new BoxAndWhiskerItem(new Double(1.0), null, new Double(0.0), new Double(4.0), new Double(0.5), new Double(4.5), new Double(-0.5), new Double(5.5), null), "S1", "C1"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("Category"), new NumberAxis("Value"), new BoxAndWhiskerRenderer()); ChartRenderingInfo info = new ChartRenderingInfo(); JFreeChart chart = new JFreeChart(plot); /* BufferedImage image = */ chart.createBufferedImage(300, 200, info); success = true; } catch (Exception e) { success = false; } assertTrue(success); }