Java Code Examples for org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset#add()
The following examples show how to use
org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset#add() .
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: BoxAndWhiskerRendererTest.java From openstock with GNU General Public License v3.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 2
Source File: BoxAndWhiskerRendererTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Draws a chart where the dataset contains a null Q1 value. */ @Test public void testDrawWithNullQ1() { boolean success; 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 3
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; } assertTrue(success); }
Example 4
Source File: BoxAndWhiskerRendererTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Draws a chart where the dataset contains a null mean value. */ @Test public void testDrawWithNullMean() { boolean success; 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; } assertTrue(success); }
Example 5
Source File: BoxAndWhiskerRendererTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Draws a chart where the dataset contains a null max regular value. */ @Test public void testDrawWithNullMaxRegular() { 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); } catch (Exception e) { fail("No exception should be thrown."); } }
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 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 7
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); }
Example 8
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 Q1 value. */ @Test public void testDrawWithNullQ1() { boolean success; 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 9
Source File: BoxAndWhiskerRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Draws a chart where the dataset contains a null Q1 value. */ @Test public void testDrawWithNullQ1() { boolean success; 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 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: BoxAndWhiskerRendererTest.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Draws a chart where the dataset contains a null mean value. */ @Test public void testDrawWithNullMean() { boolean success; 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; } assertTrue(success); }
Example 12
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 13
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the add() method. */ public void testAdd() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); BoxAndWhiskerItem item1 = new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, new ArrayList()); dataset.add(item1, "R1", "C1"); assertEquals(2.0, dataset.getValue("R1", "C1").doubleValue(), EPSILON); assertEquals(1.0, dataset.getMeanValue("R1", "C1").doubleValue(), EPSILON); assertEquals(2.0, dataset.getMedianValue("R1", "C1").doubleValue(), EPSILON); assertEquals(3.0, dataset.getQ1Value("R1", "C1").doubleValue(), EPSILON); assertEquals(4.0, dataset.getQ3Value("R1", "C1").doubleValue(), EPSILON); assertEquals(5.0, dataset.getMinRegularValue("R1", "C1").doubleValue(), EPSILON); assertEquals(6.0, dataset.getMaxRegularValue("R1", "C1").doubleValue(), EPSILON); assertEquals(7.0, dataset.getMinOutlier("R1", "C1").doubleValue(), EPSILON); assertEquals(8.0, dataset.getMaxOutlier("R1", "C1").doubleValue(), EPSILON); assertEquals(new Range(7.0, 8.0), dataset.getRangeBounds(false)); }
Example 14
Source File: DefaultBoxAndWhiskerCategoryDatasetTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some checks for the add() method. */ public void testAddUpdatesCachedRange() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); BoxAndWhiskerItem item1 = new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, new ArrayList()); dataset.add(item1, "R1", "C1"); // now overwrite this item with another BoxAndWhiskerItem item2 = new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, new ArrayList()); dataset.add(item2, "R1", "C1"); assertEquals(2.5, dataset.getValue("R1", "C1").doubleValue(), EPSILON); assertEquals(1.5, dataset.getMeanValue("R1", "C1").doubleValue(), EPSILON); assertEquals(2.5, dataset.getMedianValue("R1", "C1").doubleValue(), EPSILON); assertEquals(3.5, dataset.getQ1Value("R1", "C1").doubleValue(), EPSILON); assertEquals(4.5, dataset.getQ3Value("R1", "C1").doubleValue(), EPSILON); assertEquals(5.5, dataset.getMinRegularValue("R1", "C1").doubleValue(), EPSILON); assertEquals(6.5, dataset.getMaxRegularValue("R1", "C1").doubleValue(), EPSILON); assertEquals(7.5, dataset.getMinOutlier("R1", "C1").doubleValue(), EPSILON); assertEquals(8.5, dataset.getMaxOutlier("R1", "C1").doubleValue(), EPSILON); assertEquals(new Range(7.5, 8.5), dataset.getRangeBounds(false)); }
Example 15
Source File: BoxAndWhiskerRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A check for bug 1572478 (for the vertical orientation). */ public void testBug1572478Vertical() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset() { public Number getQ1Value(int row, int column) { return null; } public Number getQ1Value(Comparable rowKey, Comparable columnKey) { return null; } }; List values = new ArrayList(); values.add(new Double(1.0)); values.add(new Double(10.0)); values.add(new Double(100.0)); dataset.add(values, "row", "column"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"), new NumberAxis("y"), new BoxAndWhiskerRenderer()); JFreeChart chart = new JFreeChart(plot); boolean success = false; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, new ChartRenderingInfo()); g2.dispose(); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example 16
Source File: CategoryBoxplot.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
private void createDataset() { dataset = new DefaultBoxAndWhiskerCategoryDataset(); for( int i = 0; i < categories.length; i++ ) { final List<Double> list = new ArrayList<Double>(); double[] catValues = values.get(i); for( int j = 0; j < catValues.length; j++ ) { list.add(catValues[j]); } dataset.add(list, "", categories[i]); } }
Example 17
Source File: BoxAndWhiskerRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * A check for bug 1572478 (for the horizontal orientation). */ @Test public void testBug1572478Horizontal() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset() { @Override public Number getQ1Value(int row, int column) { return null; } @Override public Number getQ1Value(Comparable rowKey, Comparable columnKey) { return null; } }; List values = new ArrayList(); values.add(new Double(1.0)); values.add(new Double(10.0)); values.add(new Double(100.0)); dataset.add(values, "row", "column"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"), new NumberAxis("y"), new BoxAndWhiskerRenderer()); plot.setOrientation(PlotOrientation.HORIZONTAL); JFreeChart chart = new JFreeChart(plot); boolean success; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, new ChartRenderingInfo()); g2.dispose(); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example 18
Source File: BoxAndWhiskerRendererTest.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * A check for bug 1572478 (for the vertical orientation). */ @Test public void testBug1572478Vertical() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset() { @Override public Number getQ1Value(int row, int column) { return null; } @Override public Number getQ1Value(Comparable rowKey, Comparable columnKey) { return null; } }; List values = new ArrayList(); values.add(new Double(1.0)); values.add(new Double(10.0)); values.add(new Double(100.0)); dataset.add(values, "row", "column"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"), new NumberAxis("y"), new BoxAndWhiskerRenderer()); JFreeChart chart = new JFreeChart(plot); boolean success; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, new ChartRenderingInfo()); g2.dispose(); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example 19
Source File: BoxAndWhiskerRendererTest.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * A check for bug 1572478 (for the vertical orientation). */ @Test public void testBug1572478Vertical() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset() { @Override public Number getQ1Value(int row, int column) { return null; } @Override public Number getQ1Value(Comparable rowKey, Comparable columnKey) { return null; } }; List values = new ArrayList(); values.add(new Double(1.0)); values.add(new Double(10.0)); values.add(new Double(100.0)); dataset.add(values, "row", "column"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"), new NumberAxis("y"), new BoxAndWhiskerRenderer()); JFreeChart chart = new JFreeChart(plot); boolean success; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, new ChartRenderingInfo()); g2.dispose(); success = true; } catch (Exception e) { success = false; } assertTrue(success); }
Example 20
Source File: BoxAndWhiskerRendererTest.java From openstock with GNU General Public License v3.0 | 4 votes |
/** * A check for bug 1572478 (for the horizontal orientation). */ @Test public void testBug1572478Horizontal() { DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset() { @Override public Number getQ1Value(int row, int column) { return null; } @Override public Number getQ1Value(Comparable rowKey, Comparable columnKey) { return null; } }; List values = new ArrayList(); values.add(new Double(1.0)); values.add(new Double(10.0)); values.add(new Double(100.0)); dataset.add(values, "row", "column"); CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis("x"), new NumberAxis("y"), new BoxAndWhiskerRenderer()); plot.setOrientation(PlotOrientation.HORIZONTAL); JFreeChart chart = new JFreeChart(plot); boolean success; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, new ChartRenderingInfo()); g2.dispose(); success = true; } catch (Exception e) { success = false; } assertTrue(success); }